class photutils.aperture.RectangularMaskMixin[source]

Bases: object

Mixin class to create masks for rectangular or rectangular-annulus aperture objects.

Methods Summary

 to_mask([method, subpixels]) Return a mask for the aperture.

Methods Documentation

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 the subpixels 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. If subpixels=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 into subpixels ** 2 subpixels.

Returns
A mask for the aperture. If the aperture is scalar then a single ApertureMask is returned, otherwise a list of ApertureMask is returned.