Datasets (photutils.datasets)

Introduction

photutils.datasets gives easy access to load or make a few example datasets. The datasets are are mostly images, but they also include PSF models and a source catalog.

These datasets are useful for the Photutils documentation, tests, and benchmarks, but also for users that would like to try out or implement new methods for Photutils.

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 a 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

Let’s load an example image of M67 with load_star_image():

>>> from photutils import datasets
>>> hdu = datasets.load_star_image()  
>>> print(hdu.data.shape)  
(1059, 1059)

hdu is a FITS ImageHDU object and hdu.data is a ndarray object.

Let’s plot the image:

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

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

_images/datasets-1.png

Reference/API

Load or make datasets for examples and tests.

Functions

apply_poisson_noise(data[, random_state]) Apply Poisson noise to an array, where the value of each element in the input array represents the expected number of counts.
get_path(filename[, location, cache, …]) Get path (location on your disk) for a given file.
load_fermi_image([show_progress]) Load a Fermi counts image for the Galactic center region.
load_irac_psf(channel[, show_progress]) Load a Spitzer IRAC PSF image.
load_simulated_hst_star_image([show_progress]) Load a simulated HST WFC3/IR F160W image of stars.
load_spitzer_catalog([show_progress]) Load a 4.5 micron Spitzer catalog.
load_spitzer_image([show_progress]) Load a 4.5 micron Spitzer image.
load_star_image([show_progress]) Load an optical image of stars.
make_100gaussians_image([noise]) Make an example image containing 100 2D Gaussians plus a constant background.
make_4gaussians_image([noise]) Make an example image containing four 2D Gaussians plus a constant background.
make_gaussian_prf_sources_image(shape, …) Make an image containing 2D Gaussian sources.
make_gaussian_sources_image(shape, source_table) Make an image containing 2D Gaussian sources.
make_imagehdu(data[, wcs]) Create a FITS ImageHDU containing the input 2D image.
make_model_sources_image(shape, model, …) Make an image containing sources generated from a user-specified model.
make_noise_image(shape[, type, mean, …]) Make a noise image containing Gaussian or Poisson noise.
make_random_gaussians_table(n_sources, …) Make a Table containing randomly generated parameters for 2D Gaussian sources.
make_random_models_table(n_sources, param_ranges) Make a Table containing randomly generated parameters for an Astropy model to simulate a set of sources.
make_wcs(shape[, galactic]) Create a simple celestial WCS object in either the ICRS or Galactic coordinate frame.