PixelAperture¶

class
photutils.aperture.
PixelAperture
[source]¶ Bases:
photutils.aperture.Aperture
Abstract base class for apertures defined in pixel coordinates.
Attributes Summary
Return the exact area of the aperture shape.
The minimal bounding box for the aperture.
Deprecated since version 0.7.
Methods Summary
do_photometry
(data[, error, mask, method, …])Perform aperture photometry on the input data.
plot
([axes, origin])Plot the aperture on a matplotlib
Axes
instance.to_mask
([method, subpixels])Return a mask for the aperture.
to_sky
(wcs)Convert the aperture to a
SkyAperture
object defined in celestial coordinates.Attributes Documentation

area
¶ Return the exact area of the aperture shape.
 Returns
 areafloat
The aperture area.

bbox
¶ The minimal bounding box for the aperture.
If the aperture is scalar then a single
BoundingBox
is returned, otherwise a list ofBoundingBox
is returned.

bounding_boxes
¶ Deprecated since version 0.7: The bounding_boxes function is deprecated and may be removed in a future version. Use bbox instead.
The minimal bounding box for the aperture.
Methods Documentation

do_photometry
(data, error=None, mask=None, method='exact', subpixels=5)[source]¶ Perform aperture photometry on the input data.
 Parameters
 dataarray_like or
Quantity
instance The 2D array on which to perform photometry.
data
should be background subtracted. errorarray_like or
Quantity
, optional The pixelwise Gaussian 1sigma errors of the input
data
.error
is assumed to include all sources of error, including the Poisson error of the sources (seecalc_total_error
) .error
must have the same shape as the inputdata
. maskarray_like (bool), optional
A boolean mask with the same shape as
data
where aTrue
value indicates the corresponding element ofdata
is masked. Masked data are excluded from all calculations. method{‘exact’, ‘center’, ‘subpixel’}, optional
The method used to determine the overlap of the aperture on the pixel grid. Not all options are available for all aperture types. Note that the more precise methods are generally slower. The following methods are available:
'exact'
(default): The the exact fractional overlap of the aperture and each pixel is calculated. The returned mask will contain values between 0 and 1.'center'
: A pixel is considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. The returned mask will contain values only of 0 (out) and 1 (in).'subpixel'
A pixel is divided into subpixels (see thesubpixels
keyword), each of which are considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. Ifsubpixels=1
, this method is equivalent to'center'
. The returned mask will contain values between 0 and 1.
 subpixelsint, optional
For the
'subpixel'
method, resample pixels by this factor in each dimension. That is, each pixel is divided intosubpixels ** 2
subpixels.
 dataarray_like or
 Returns

plot
(axes=None, origin=0, 0, **kwargs)[source]¶ Plot the aperture on a matplotlib
Axes
instance. Parameters
 axes
matplotlib.axes.Axes
orNone
, optional The matplotlib axes on which to plot. If
None
, then the currentAxes
instance is used. originarray_like, optional
The
(x, y)
position of the origin of the displayed image. kwargs
dict
Any keyword arguments accepted by
matplotlib.patches.Patch
.
 axes
 Returns
 patchlist of
Patch
A list of matplotlib patches for the plotted aperture. The patches can be used, for example, when adding a plot legend.
 patchlist of

abstract
to_mask
(method='exact', subpixels=5)[source]¶ Return a mask for the aperture.
 Parameters
 method{‘exact’, ‘center’, ‘subpixel’}, optional
The method used to determine the overlap of the aperture on the pixel grid. Not all options are available for all aperture types. Note that the more precise methods are generally slower. The following methods are available:
'exact'
(default): The the exact fractional overlap of the aperture and each pixel is calculated. The returned mask will contain values between 0 and 1.'center'
: A pixel is considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. The returned mask will contain values only of 0 (out) and 1 (in).'subpixel'
: A pixel is divided into subpixels (see thesubpixels
keyword), each of which are considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. Ifsubpixels=1
, this method is equivalent to'center'
. The returned mask will contain values between 0 and 1.
 subpixelsint, optional
For the
'subpixel'
method, resample pixels by this factor in each dimension. That is, each pixel is divided intosubpixels ** 2
subpixels.
 Returns
 mask
ApertureMask
or list ofApertureMask
A mask for the aperture. If the aperture is scalar then a single
ApertureMask
is returned, otherwise a list ofApertureMask
is returned.
 mask

abstract
to_sky
(wcs)[source]¶ Convert the aperture to a
SkyAperture
object defined in celestial coordinates. Parameters
 wcsWCS object
A world coordinate system (WCS) transformation that supports the astropy shared interface for WCS (e.g.,
astropy.wcs.WCS
,gwcs.wcs.WCS
).
 Returns
 aperture
SkyAperture
object A
SkyAperture
object.
 aperture
