ApertureMask¶

class
photutils.aperture.
ApertureMask
(data, bbox)[source]¶ Bases:
object
Class for an aperture mask.
 Parameters
 dataarray_like
A 2D array representing the fractional overlap of an aperture on the pixel grid. This should be the fullsized (i.e., not truncated) array that is the direct output of one of the lowlevel
photutils.geometry
functions. bbox
photutils.aperture.BoundingBox
The bounding box object defining the aperture minimal bounding box.
Attributes Summary
The shape of the mask data array.
Methods Summary
cutout
(data[, fill_value, copy])Create a cutout from the input data over the mask bounding box, taking any edge effects into account.
multiply
(data[, fill_value])Multiply the aperture mask with the input data, taking any edge effects into account.
to_image
(shape)Return an image of the mask in a 2D array of the given shape, taking any edge effects into account.
Attributes Documentation

shape
¶ The shape of the mask data array.
Methods Documentation

cutout
(data, fill_value=0.0, copy=False)[source]¶ Create a cutout from the input data over the mask bounding box, taking any edge effects into account.
 Parameters
 dataarray_like
A 2D array on which to apply the aperture mask.
 fill_valuefloat, optional
The value used to fill pixels where the aperture mask does not overlap with the input
data
. The default is 0. copybool, optional
If
True
then the returned cutout array will always be hold a copy of the inputdata
. IfFalse
and the mask is fully within the inputdata
, then the returned cutout array will be a view into the inputdata
. In cases where the mask partially overlaps or has no overlap with the inputdata
, the returned cutout array will always hold a copy of the inputdata
(i.e., this keyword has no effect).
 Returns
 result
ndarray
A 2D array cut out from the input
data
representing the same cutout region as the aperture mask. If there is a partial overlap of the aperture mask with the input data, pixels outside of the data will be assigned tofill_value
.None
is returned if there is no overlap of the aperture with the inputdata
.
 result

multiply
(data, fill_value=0.0)[source]¶ Multiply the aperture mask with the input data, taking any edge effects into account.
The result is a maskweighted cutout from the data.
 Parameters
 dataarray_like or
Quantity
The 2D array to multiply with the aperture mask.
 fill_valuefloat, optional
The value is used to fill pixels where the aperture mask does not overlap with the input
data
. The default is 0.
 dataarray_like or
 Returns
 result
ndarray
orNone
A 2D maskweighted cutout from the input
data
. If there is a partial overlap of the aperture mask with the input data, pixels outside of the data will be assigned tofill_value
before being multipled with the mask.None
is returned if there is no overlap of the aperture with the inputdata
.
 result