# RectangularAnnulus¶

class photutils.RectangularAnnulus(positions, w_in, w_out, h_out, theta=0.0)[source]

Rectangular annulus aperture(s), defined in pixel coordinates.

Parameters: positions : array_like or Quantity Pixel coordinates of the aperture center(s) in one of the following formats: single (x, y) tuple list of (x, y) tuples Nx2 or 2xN ndarray Nx2 or 2xN Quantity in pixel units Note that a 2x2 ndarray or Quantity is interpreted as Nx2, i.e. two rows of (x, y) coordinates. w_in : float The inner full width of the aperture. For theta=0 the width side is along the x axis. w_out : float The outer full width of the aperture. For theta=0 the width side is along the x axis. h_out : float The outer full height of the aperture. The inner full height is calculated as: $h_{in} = h_{out} \left(\frac{w_{in}}{w_{out}}\right)$ For theta=0 the height side is along the y axis. theta : float, optional The rotation angle in radians of the width side from the positive x axis. The rotation angle increases counterclockwise. The default is 0. ValueError : ValueError If inner width (w_in) is greater than outer width (w_out). ValueError : ValueError If either the inner width (w_in) or the outer height (h_out) is negative.

Attributes Summary

 bounding_boxes A list of minimal bounding boxes (BoundingBox), one for each position, enclosing the rectangular apertures for the “exact” case.

Methods Summary

 area() Return the exact area of the aperture shape. plot([origin, indices, ax, fill]) Plot the aperture(s) on a matplotlib Axes instance. to_sky(wcs[, mode]) Convert the aperture to a SkyRectangularAnnulus object defined in celestial coordinates.

Attributes Documentation

bounding_boxes

A list of minimal bounding boxes (BoundingBox), one for each position, enclosing the rectangular apertures for the “exact” case.

Methods Documentation

area()[source]

Return the exact area of the aperture shape.

Returns: area : float The aperture area.
plot(origin=(0, 0), indices=None, ax=None, fill=False, **kwargs)[source]

Plot the aperture(s) on a matplotlib Axes instance.

Parameters: origin : array_like, optional The (x, y) position of the origin of the displayed image. indices : int or array of int, optional The indices of the aperture(s) to plot. ax : matplotlib.axes.Axes instance, optional If None, then the current Axes instance is used. fill : bool, optional Set whether to fill the aperture patch. The default is False. kwargs Any keyword arguments accepted by matplotlib.patches.Patch.
to_sky(wcs, mode='all')[source]

Convert the aperture to a SkyRectangularAnnulus object defined in celestial coordinates.

Parameters: wcs : WCS The world coordinate system (WCS) transformation to use. mode : {‘all’, ‘wcs’}, optional Whether to do the transformation including distortions ('all'; default) or only including only the core WCS transformation ('wcs'). aperture : A SkyRectangularAnnulus object.