RectangularAnnulus

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

Bases: photutils.aperture.RectangularMaskMixin, photutils.aperture.PixelAperture

A rectangular annulus aperture defined in pixel coordinates.

The aperture has a single fixed size/shape, but it can have multiple positions (see the positions input).

Parameters
positionsarray_like or Quantity

The pixel coordinates of the aperture center(s) in one of the following formats:

  • single (x, y) pair as a tuple, list, or ndarray

  • tuple, list, or ndarray of (x, y) pairs

  • Quantity instance of (x, y) pairs in pixel units

w_infloat

The inner full width of the rectangular annulus in pixels. For theta=0 the width side is along the x axis.

w_outfloat

The outer full width of the rectangular annulus in pixels. For theta=0 the width side is along the x axis.

h_outfloat

The outer full height of the rectangular annulus in pixels.

h_inNone or float

The inner full height of the rectangular annulus in pixels. If None, then 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.

thetafloat, optional

The rotation angle in radians of the rectangle “width” side from the positive x axis. The rotation angle increases counterclockwise. The default is 0.

Raises
ValueErrorValueError

If inner width (w_in) is greater than outer width (w_out).

ValueErrorValueError

If either the inner width (w_in) or the outer height (h_out) is negative.

Examples

>>> from photutils import RectangularAnnulus
>>> aper = RectangularAnnulus([10., 20.], 3., 8., 5.)
>>> aper = RectangularAnnulus((10., 20.), 3., 8., 5., theta=np.pi)
>>> pos1 = (10., 20.)  # (x, y)
>>> pos2 = (30., 40.)
>>> pos3 = (50., 60.)
>>> aper = RectangularAnnulus([pos1, pos2, pos3], 3., 8., 5.)
>>> aper = RectangularAnnulus((pos1, pos2, pos3), 3., 8., 5., theta=np.pi)

Attributes Summary

area

Return the exact area of the aperture shape.

h_in

Check that value is a stricly positive (>= 0) scalar.

h_out

Check that value is a stricly positive (>= 0) scalar.

positions

Validate and set positions for pixel-based apertures.

theta

Check that value is a scalar.

w_in

Check that value is a stricly positive (>= 0) scalar.

w_out

Check that value is a stricly positive (>= 0) scalar.

Methods Summary

to_sky(wcs)

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

Attributes Documentation

area
h_in

Check that value is a stricly positive (>= 0) scalar.

h_out

Check that value is a stricly positive (>= 0) scalar.

positions

Validate and set positions for pixel-based apertures.

In all cases, pixel positions are converted to a 2D ndarray (without units).

theta

Check that value is a scalar.

w_in

Check that value is a stricly positive (>= 0) scalar.

w_out

Check that value is a stricly positive (>= 0) scalar.

Methods Documentation

to_sky(wcs)[source]

Convert the aperture to a SkyRectangularAnnulus 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
apertureSkyRectangularAnnulus object

A SkyRectangularAnnulus object.