Datasets (photutils.datasets)

Introduction

photutils.datasets gives easy access to a few example datasets (mostly images, but also e.g. source catalogs or PSF models).

This is useful for the Photutils documentation, tests, and benchmarks, but also for users that would like to try out Photutils functions or implement new methods for Photutils or their own scripts.

Functions that start with load_* load data files from disk. Very small data files are bundled in the Photutils code repository and are guaranteed to be available. Mid-sized data files are currently available from the astropy-data repository and loaded into the Astropy cache on the user’s machine on first load.

Functions that start with make_* generate simple simulated data (e.g. Gaussian sources on flat background with Poisson or Gaussian noise). Note that there are other tools like skymaker that can simulate much more realistic astronomical images.

Getting Started

To load an example image with load_star_image:

>>> from photutils import datasets
>>> hdu = datasets.load_star_image()  
Downloading http://data.astropy.org/photometry/M6707HH.fits [Done]
>>> print(hdu.data.shape)  
(1059, 1059)

hdu is an astropy.io.fits.ImageHDU object and hdu.data is a numpy.array object that you can analyse with Photutils.

Let’s plot the image:

from photutils import datasets
hdu = datasets.load_star_image()
plt.imshow(hdu.data, origin='lower', cmap='gray')
plt.tight_layout()
plt.show()

(Source code, png, hires.png, pdf)

../_images/datasets-1.png

Reference/API

Load or make datasets for examples and tests.

Functions

get_path(filename[, location, cache]) Get path (location on your disk) for a given file.
load_fermi_image() Load Fermi counts image for the Galactic center region.
load_irac_psf(channel) Load Spitzer IRAC PSF.
load_spitzer_catalog() Load 4.5 micron Spitzer catalog.
load_spitzer_image() Load 4.5 micron Spitzer image.
load_star_image() Load an optical image with stars.
make_100gaussians_image() Make an example image containing 100 2D Gaussians plus Gaussian noise.
make_4gaussians_image([hdu, wcs, wcsheader]) Make an example image containing four 2D Gaussians plus Gaussian noise.
make_gaussian_sources(image_shape, source_table) Make an image containing 2D Gaussian sources.
make_noise_image(image_shape[, type, mean, ...]) Make a noise image containing Gaussian or Poisson noise.
make_poisson_noise(image[, random_state]) Make a Poisson noise image from an image whose pixel values represent the expected number of counts (e.g., electrons or photons).
make_random_gaussians(n_sources, flux_range, ...) Make a Table containing parameters for randomly generated 2D Gaussian sources.