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, 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 a 2D array as its “center of mass” determined from image moments.
create_matching_kernel(source_psf, target_psf) Create a kernel to match 2D point spread functions (PSF) using the ratio of Fourier transforms.
daofind(*args, **kwargs)

Deprecated since version 0.3.

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.
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.
irafstarfind(*args, **kwargs)

Deprecated since version 0.3.

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.
properties_table(source_props[, columns, ...]) Construct a Table of properties from a list of SourceProperties objects.
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([package, test_path, args, plugins, ...]) Run the tests using py.test.

Classes

Aperture Abstract base class for all apertures.
ApertureMask(mask, bbox_slice) Class for an aperture mask.
Background2D(data, box_size[, mask, ...]) Class to estimate a 2D background and background RMS noise in an image.
BackgroundBase Base class for classes that estimate scalar background values.
BackgroundRMSBase 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 Class to calculate the background in an array using the biweight location.
BiweightMidvarianceBackgroundRMS Class to calculate the background RMS in an array as the (sigma-clipped) biweight midvariance.
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.
CircularAnnulus Circular annulus aperture(s), defined in pixel coordinates.
CircularAperture 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 is 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 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.
EllipticalAnnulus Elliptical annulus aperture(s), defined in pixel coordinates.
EllipticalAperture Elliptical aperture(s), defined in pixel coordinates.
EllipticalMaskMixin Mixin class to create masks for elliptical and elliptical-annulus aperture objects.
FittableImageModel A fittable 2D model of an image allowing for image intensity scaling and image translations.
GaussianConst2D A model for a 2D Gaussian plus a constant.
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 Detect stars in an image using IRAF’s “starfind” algorithm.
IntegratedGaussianPRF Circular Gaussian model integrated over pixels.
IterativelySubtractedPSFPhotometry(...[, ...]) This class implements an iterative algorithm to perform point spread function photometry in crowded fields.
MADStdBackgroundRMS Class to calculate the background RMS in an array as using the median absolute deviation (MAD).
MMMBackground Class to calculate the background in an array using the DAOPHOT MMM algorithm.
MeanBackground Class to calculate the background in an array as the (sigma-clipped) mean.
MedianBackground Class to calculate the background in an array as the (sigma-clipped) median.
ModeEstimatorBackground 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 A model that adapts a supplied PSF model to act as a PRF.
PixelAperture Abstract base class for 2D apertures defined in pixel coordinates.
RectangularAnnulus Rectangular annulus aperture(s), defined in pixel coordinates.
RectangularAperture Rectangular aperture(s), defined in pixel coordinates.
RectangularMaskMixin Mixin class to create masks for rectangular or rectangular-annulus aperture objects.
SExtractorBackground Class to calculate the background in an array using the SExtractor algorithm.
SegmentationImage(data) Class for a segmentation image.
SigmaClip([sigma, sigma_lower, sigma_upper, ...]) Class to perform sigma clipping.
SkyAperture Abstract base class for 2D apertures defined in celestial coordinates.
SkyCircularAnnulus Circular annulus aperture(s), defined in sky coordinates.
SkyCircularAperture Circular aperture(s), defined in sky coordinates.
SkyEllipticalAnnulus Elliptical annulus aperture(s), defined in sky coordinates.
SkyEllipticalAperture Elliptical aperture(s), defined in sky coordinates.
SkyRectangularAnnulus Rectangular annulus aperture(s), defined in sky coordinates.
SkyRectangularAperture Rectangular aperture(s), defined in sky coordinates.
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.
StarFinderBase Abstract base class for Star Finders.
StdBackgroundRMS 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.

Class Inheritance Diagram

Inheritance diagram of photutils.aperture.core.Aperture, photutils.aperture.core.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.BiweightMidvarianceBackgroundRMS, photutils.background.background_2d.BkgIDWInterpolator, photutils.background.background_2d.BkgZoomInterpolator, 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.aperture.ellipse.EllipticalAnnulus, photutils.aperture.ellipse.EllipticalAperture, photutils.aperture.ellipse.EllipticalMaskMixin, photutils.psf.models.FittableImageModel, photutils.centroids.core.GaussianConst2D, photutils.psf.groupstars.GroupStarsBase, photutils.psf.matching.windows.HanningWindow, photutils.detection.findstars.IRAFStarFinder, photutils.psf.models.IntegratedGaussianPRF, photutils.psf.photometry.IterativelySubtractedPSFPhotometry, 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.SegmentationImage, photutils.background.core.SigmaClip, 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.SourceProperties, photutils.psf.matching.windows.SplitCosineBellWindow, photutils.detection.findstars.StarFinderBase, photutils.background.core.StdBackgroundRMS, photutils.psf.matching.windows.TopHatWindow, photutils.psf.matching.windows.TukeyWindow