API Reference

These are the functions and classes available in the top-level photutils namespace. Other functionality is available by importing specific sub-packages (e.g. photutils.utils).

Photutils is an Astropy affiliated package to provide tools for detecting and performing photometry of astronomical sources. It also has tools for background estimation, ePSF building, PSF matching, centroiding, and morphological measurements.

Functions

aperture_photometry(data, apertures[, …]) Perform aperture photometry on the input data by summing the flux within the given aperture(s).
centroid_1dg(data[, error, mask]) Calculate the centroid of a 2D array by fitting 1D Gaussians to the marginal x and y distributions of the array.
centroid_2dg(data[, error, mask]) Calculate the centroid of a 2D array by fitting a 2D Gaussian (plus a constant) to the array.
centroid_com(data[, mask]) Calculate the centroid of an n-dimensional array as its “center of mass” determined from moments.
centroid_sources(data, xpos, ypos[, …]) Calculate the centroid of sources at the defined positions.
create_matching_kernel(source_psf, target_psf) Create a kernel to match 2D point spread functions (PSF) using the ratio of Fourier transforms.
data_properties(data[, mask, background]) Calculate the morphological properties (and centroid) of a 2D array (e.g.
deblend_sources(data, segment_img, npixels) Deblend overlapping sources labeled in a segmentation image.
detect_sources(data, threshold, npixels[, …]) Detect sources above a specified threshold value in an image and return a SegmentationImage object.
detect_threshold(data, snr[, background, …]) Calculate a pixel-wise threshold image that can be used to detect sources.
extract_stars(data, catalogs[, size]) Extract cutout images centered on stars defined in the input catalog(s).
find_peaks(data, threshold[, box_size, …]) Find local peaks in an image that are above above a specified threshold value.
fit_2dgaussian(data[, error, mask]) Fit a 2D Gaussian plus a constant to a 2D image.
gaussian1d_moments(data[, mask]) Estimate 1D Gaussian parameters from the moments of 1D data.
get_grouped_psf_model(template_psf_model, …) Construct a joint PSF model which consists of a sum of PSF’s templated on a specific model, but whose parameters are given by a table of objects.
gini(data) Calculate the Gini coefficient of a 2D array.
make_source_mask(data, snr, npixels[, mask, …]) Make a source mask using source segmentation and binary dilation.
prepare_psf_model(psfmodel[, xname, yname, …]) Convert a 2D PSF model to one suitable for use with BasicPSFPhotometry or its subclasses.
resize_psf(psf, input_pixel_scale, …[, order]) Resize a PSF using spline interpolation of the requested order.
source_properties(data, segment_img[, …]) Calculate photometry and morphological properties of sources defined by a labeled segmentation image.
subtract_psf(data, psf, posflux[, subshape]) Subtract PSF/PRFs from an image.
test(**kwargs) Run the tests for the package.

Classes

Aperture Abstract base class for all apertures.
ApertureMask(data, bbox) Class for an aperture mask.
Background2D(data, box_size[, mask, …]) Class to estimate a 2D background and background RMS noise in an image.
BackgroundBase([sigma_clip, sigma_lower, …]) Base class for classes that estimate scalar background values.
BackgroundRMSBase([sigma_clip, sigma_lower, …]) Base class for classes that estimate scalar background RMS values.
BasicPSFPhotometry(group_maker, …[, …]) This class implements a PSF photometry algorithm that can find sources in an image, group overlapping sources into a single model, fit the model to the sources, and subtracting the models from the image.
BiweightLocationBackground([c, M]) Class to calculate the background in an array using the biweight location.
BiweightScaleBackgroundRMS([c, M]) Class to calculate the background RMS in an array as the (sigma-clipped) biweight scale.
BkgIDWInterpolator([leafsize, n_neighbors, …]) This class generates full-sized background and background RMS images from lower-resolution mesh images using inverse-distance weighting (IDW) interpolation (ShepardIDWInterpolator).
BkgZoomInterpolator([order, mode, cval]) This class generates full-sized background and background RMS images from lower-resolution mesh images using the zoom (spline) interpolator.
BoundingBox(ixmin, ixmax, iymin, iymax) A rectangular bounding box in integer (not float) pixel indices.
CircularAnnulus(positions, r_in, r_out) Circular annulus aperture(s), defined in pixel coordinates.
CircularAperture(positions, r) Circular aperture(s), defined in pixel coordinates.
CircularMaskMixin Mixin class to create masks for circular and circular-annulus aperture objects.
CosineBellWindow(alpha) Class to define a 2D cosine bell window function.
DAOGroup(crit_separation) This class implements the DAOGROUP algorithm presented by Stetson (1987).
DAOPhotPSFPhotometry(crit_separation, …[, …]) This class implements an iterative algorithm based on the DAOPHOT algorithm presented by Stetson (1987) to perform point spread function photometry in crowded fields.
DAOStarFinder(threshold, fwhm[, ratio, …]) Detect stars in an image using the DAOFIND (Stetson 1987) algorithm.
DBSCANGroup(crit_separation[, min_samples, …]) Class to create star groups according to a distance criteria using the Density-based Spatial Clustering of Applications with Noise (DBSCAN) from scikit-learn.
EPSFBuilder([pixel_scale, oversampling, …]) Class to build an effective PSF (ePSF).
EPSFFitter([fitter, fit_boxsize]) Class to fit an ePSF model to one or more stars.
EPSFModel(data[, flux, x_0, y_0, normalize, …]) A subclass of FittableImageModel.
EPSFStar(data[, weights, cutout_center, …]) A class to hold a 2D cutout image and associated metadata of a star used to build an ePSF.
EPSFStars(stars_list) Class to hold a list of EPSFStar and/or LinkedEPSFStar objects.
EllipticalAnnulus(positions, a_in, a_out, b_out) Elliptical annulus aperture(s), defined in pixel coordinates.
EllipticalAperture(positions, a, b[, theta]) Elliptical aperture(s), defined in pixel coordinates.
EllipticalMaskMixin Mixin class to create masks for elliptical and elliptical-annulus aperture objects.
FittableImageModel(data[, flux, x_0, y_0, …]) A fittable 2D model of an image allowing for image intensity scaling and image translations.
GaussianConst2D([constant, amplitude, …]) A model for a 2D Gaussian plus a constant.
GriddedPSFModel(data[, flux, x_0, y_0, …]) A fittable 2D model containing a grid PSF models defined at specific locations that are interpolated to evaluate a PSF at an arbitrary (x, y) position.
GroupStarsBase This base class provides the basic interface for subclasses that are capable of classifying stars in groups.
HanningWindow() Class to define a 2D Hanning (or Hann) window function.
IRAFStarFinder(threshold, fwhm[, …]) Detect stars in an image using IRAF’s “starfind” algorithm.
IntegratedGaussianPRF([sigma, x_0, y_0, flux]) Circular Gaussian model integrated over pixels.
IterativelySubtractedPSFPhotometry(…[, …]) This class implements an iterative algorithm to perform point spread function photometry in crowded fields.
LinkedEPSFStar(stars_list) A class to hold a list of EPSFStar objects for linked stars.
LinkedStar(stars_list)

Deprecated since version 0.6.

MADStdBackgroundRMS([sigma_clip, …]) Class to calculate the background RMS in an array as using the median absolute deviation (MAD).
MMMBackground(**kwargs) Class to calculate the background in an array using the DAOPHOT MMM algorithm.
MeanBackground([sigma_clip, sigma_lower, …]) Class to calculate the background in an array as the (sigma-clipped) mean.
MedianBackground([sigma_clip, sigma_lower, …]) Class to calculate the background in an array as the (sigma-clipped) median.
ModeEstimatorBackground([median_factor, …]) Class to calculate the background in an array using a mode estimator of the form (median_factor * median) - (mean_factor * mean).
NonNormalizable Used to indicate that a FittableImageModel model is non-normalizable.
PRFAdapter(psfmodel[, renormalize_psf, …]) A model that adapts a supplied PSF model to act as a PRF.
PixelAperture Abstract base class for apertures defined in pixel coordinates.
RectangularAnnulus(positions, w_in, w_out, h_out) Rectangular annulus aperture(s), defined in pixel coordinates.
RectangularAperture(positions, w, h[, theta]) Rectangular aperture(s), defined in pixel coordinates.
RectangularMaskMixin Mixin class to create masks for rectangular or rectangular-annulus aperture objects.
SExtractorBackground([sigma_clip, …]) Class to calculate the background in an array using the SExtractor algorithm.
Segment(segment_img, label, slices, area) Class for a single labeled region (segment) within a segmentation image.
SegmentationImage(data) Class for a segmentation image.
SkyAperture Abstract base class for all apertures defined in celestial coordinates.
SkyCircularAnnulus(positions, r_in, r_out) Circular annulus aperture(s), defined in sky coordinates.
SkyCircularAperture(positions, r) Circular aperture(s), defined in sky coordinates.
SkyEllipticalAnnulus(positions, a_in, a_out, …) Elliptical annulus aperture(s), defined in sky coordinates.
SkyEllipticalAperture(positions, a, b[, theta]) Elliptical aperture(s), defined in sky coordinates.
SkyRectangularAnnulus(positions, w_in, …) Rectangular annulus aperture(s), defined in sky coordinates.
SkyRectangularAperture(positions, w, h[, theta]) Rectangular aperture(s), defined in sky coordinates.
SourceCatalog(properties_list[, wcs]) Class to hold source catalogs.
SourceProperties(data, segment_img, label[, …]) Class to calculate photometry and morphological properties of a single labeled source.
SplitCosineBellWindow(alpha, beta) Class to define a 2D split cosine bell taper function.
Star(data[, weights, cutout_center, origin, …])

Deprecated since version 0.6.

StarFinderBase Abstract base class for star finders.
Stars(stars_list)

Deprecated since version 0.6.

StdBackgroundRMS([sigma_clip, sigma_lower, …]) Class to calculate the background RMS in an array as the (sigma-clipped) standard deviation.
TopHatWindow(beta) Class to define a 2D top hat window function.
TukeyWindow(alpha) Class to define a 2D Tukey window function.
UnsupportedPythonError

Class Inheritance Diagram

Inheritance diagram of photutils.aperture.core.Aperture, photutils.aperture.mask.ApertureMask, photutils.background.background_2d.Background2D, photutils.background.core.BackgroundBase, photutils.background.core.BackgroundRMSBase, photutils.psf.photometry.BasicPSFPhotometry, photutils.background.core.BiweightLocationBackground, photutils.background.core.BiweightScaleBackgroundRMS, photutils.background.background_2d.BkgIDWInterpolator, photutils.background.background_2d.BkgZoomInterpolator, photutils.aperture.bounding_box.BoundingBox, photutils.aperture.circle.CircularAnnulus, photutils.aperture.circle.CircularAperture, photutils.aperture.circle.CircularMaskMixin, photutils.psf.matching.windows.CosineBellWindow, photutils.psf.groupstars.DAOGroup, photutils.psf.photometry.DAOPhotPSFPhotometry, photutils.detection.findstars.DAOStarFinder, photutils.psf.groupstars.DBSCANGroup, photutils.psf.epsf.EPSFBuilder, photutils.psf.epsf.EPSFFitter, photutils.psf.models.EPSFModel, photutils.psf.epsf_stars.EPSFStar, photutils.psf.epsf_stars.EPSFStars, photutils.aperture.ellipse.EllipticalAnnulus, photutils.aperture.ellipse.EllipticalAperture, photutils.aperture.ellipse.EllipticalMaskMixin, photutils.psf.models.FittableImageModel, photutils.centroids.core.GaussianConst2D, photutils.psf.models.GriddedPSFModel, photutils.psf.groupstars.GroupStarsBase, photutils.psf.matching.windows.HanningWindow, photutils.detection.findstars.IRAFStarFinder, photutils.psf.models.IntegratedGaussianPRF, photutils.psf.photometry.IterativelySubtractedPSFPhotometry, photutils.psf.epsf_stars.LinkedEPSFStar, photutils.psf.epsf_stars.LinkedStar, photutils.background.core.MADStdBackgroundRMS, photutils.background.core.MMMBackground, photutils.background.core.MeanBackground, photutils.background.core.MedianBackground, photutils.background.core.ModeEstimatorBackground, photutils.psf.models.NonNormalizable, photutils.psf.models.PRFAdapter, photutils.aperture.core.PixelAperture, photutils.aperture.rectangle.RectangularAnnulus, photutils.aperture.rectangle.RectangularAperture, photutils.aperture.rectangle.RectangularMaskMixin, photutils.background.core.SExtractorBackground, photutils.segmentation.core.Segment, photutils.segmentation.core.SegmentationImage, photutils.aperture.core.SkyAperture, photutils.aperture.circle.SkyCircularAnnulus, photutils.aperture.circle.SkyCircularAperture, photutils.aperture.ellipse.SkyEllipticalAnnulus, photutils.aperture.ellipse.SkyEllipticalAperture, photutils.aperture.rectangle.SkyRectangularAnnulus, photutils.aperture.rectangle.SkyRectangularAperture, photutils.segmentation.properties.SourceCatalog, photutils.segmentation.properties.SourceProperties, photutils.psf.matching.windows.SplitCosineBellWindow, photutils.psf.epsf_stars.Star, photutils.detection.findstars.StarFinderBase, photutils.psf.epsf_stars.Stars, photutils.background.core.StdBackgroundRMS, photutils.psf.matching.windows.TopHatWindow, photutils.psf.matching.windows.TukeyWindow, photutils.UnsupportedPythonError