EllipticalAperture

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

Bases: photutils.EllipticalMaskMixin, photutils.PixelAperture

Elliptical 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.

a : float

The semimajor axis.

b : float

The semiminor axis.

theta : float, optional

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

Raises:
ValueError : ValueError

If either axis (a or b) is negative.

Attributes Summary

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

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 SkyEllipticalAperture object defined in celestial coordinates.

Attributes Documentation

bounding_boxes

A list of minimal bounding boxes (BoundingBox), one for each position, enclosing the exact elliptical apertures.

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 SkyEllipticalAperture 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').

Returns:
aperture : SkyEllipticalAperture object

A SkyEllipticalAperture object.