Datasets (photutils.datasets)


photutils.datasets gives easy access to load or make a few example datasets. The datasets 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.datasets import load_star_image
>>> hdu = load_star_image()  
>>> print(  
(1059, 1059)

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

Let’s plot the image:

import matplotlib.pyplot as plt
from photutils.datasets import load_star_image

hdu = load_star_image()
plt.imshow(, origin='lower', interpolation='nearest')

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



This subpackage contains tools for making or loading datasets for examples and tests.


apply_poisson_noise(data[, seed])

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 the local path for a given file.

load_irac_psf(channel[, show_progress])

Load a Spitzer IRAC PSF image.


Load a simulated HST WFC3/IR F160W image of stars.


Load a 4.5 micron Spitzer catalog.


Load a 4.5 micron Spitzer image.


Load an optical image of stars.


Make an example image containing 100 2D Gaussians plus a constant background.


Make an example image containing four 2D Gaussians plus a constant background.

make_gaussian_prf_sources_image(shape, ...)

Deprecated since version 1.13.0.

make_gaussian_sources_image(shape, source_table)

Deprecated since version 1.13.0.

make_gwcs(shape[, galactic])

Create a simple celestial gWCS object in the ICRS coordinate frame.

make_imagehdu(data[, wcs])

Deprecated since version 1.13.0.

make_model_image(shape, model, params_table, *)

Make a 2D image containing sources generated from a user-specified astropy 2D model.

make_model_params(shape, n_sources, *[, ...])

Make a table of randomly generated model positions and fluxes for simulated sources.

make_model_sources_image(shape, model, ...)

Deprecated since version 1.13.0.

make_noise_image(shape[, distribution, ...])

Make a noise image containing Gaussian or Poisson noise.

make_random_gaussians_table(n_sources, ...)

Deprecated since version 1.13.0.

make_random_models_table(n_sources, param_ranges)

Make a QTable containing randomly generated parameters for an Astropy model to simulate a set of sources.

make_test_psf_data(shape, psf_model, ...[, ...])

Deprecated since version 1.13.0.

make_wcs(shape[, galactic])

Create a simple celestial WCS object in either the ICRS or Galactic coordinate frame.