EllipticalAperture

class photutils.aperture.EllipticalAperture(positions, a, b, theta=0.0)[source]

Bases: photutils.aperture.EllipticalMaskMixin, photutils.aperture.PixelAperture

An elliptical 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

afloat

The semimajor axis of the ellipse in pixels.

bfloat

The semiminor axis of the ellipse in pixels.

thetafloat, optional

The rotation angle in radians of the ellipse semimajor axis from the positive x axis. The rotation angle increases counterclockwise. The default is 0.

Raises
ValueErrorValueError

If either axis (a or b) is negative.

Examples

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

Attributes Summary

a

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

area

Return the exact area of the aperture shape.

b

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

positions

Validate and set positions for pixel-based apertures.

theta

Check that value is a scalar.

Methods Summary

to_sky(wcs)

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

Attributes Documentation

a

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

area
b

Check that value is a strictly 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.

Methods Documentation

to_sky(wcs)[source]

Convert the aperture to a SkyEllipticalAperture 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
apertureSkyEllipticalAperture object

A SkyEllipticalAperture object.