SkyCircularAperture#

class photutils.aperture.SkyCircularAperture(positions, r)[source]#

Bases: SkyAperture

A circular aperture defined in sky coordinates.

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

Parameters:
positionsSkyCoord

The celestial coordinates of the aperture center(s). This can be either scalar coordinates or an array of coordinates.

rscalar Quantity

The radius of the circle in angular units.

Raises:
TypeErrorTypeError

If the input radius, r, is not a Quantity.

ValueErrorValueError

If the input radius, r, is not positive.

Examples

>>> from astropy.coordinates import SkyCoord
>>> import astropy.units as u
>>> from photutils.aperture import SkyCircularAperture
>>> positions = SkyCoord(ra=[10.0, 20.0], dec=[30.0, 40.0], unit='deg')
>>> aper = SkyCircularAperture(positions, 0.5*u.arcsec)

Attributes Summary

isscalar

Whether the instance is scalar (i.e., a single position).

positions

The center position(s) in sky coordinates.

r

The radius in angular units.

shape

The shape of the instance.

Methods Summary

copy()

Make a deep copy of this object.

to_pixel(wcs, *[, as_ellipse])

Convert the aperture to a CircularAperture object defined in pixel coordinates.

to_polygon(*[, n_vertices])

Return a SkyPolygonAperture that approximates this circular aperture.

Attributes Documentation

isscalar#

Whether the instance is scalar (i.e., a single position).

positions#

The center position(s) in sky coordinates.

r#

The radius in angular units.

shape#

The shape of the instance.

Methods Documentation

copy()#

Make a deep copy of this object.

Returns:
resultAperture

A deep copy of the Aperture object.

to_pixel(wcs, *, as_ellipse=False)[source]#

Convert the aperture to a CircularAperture object defined in pixel 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).

as_ellipsebool, optional

If True, return the image of the circle under the local linear WCS at the reference position, which is an ellipse whenever the pixels are not square or the WCS is sheared. If False (the default), return a circle whose radius is scaled by the isotropic mean pixel scale.

Returns:
apertureCircularAperture or EllipticalAperture

The pixel aperture. An EllipticalAperture is returned if as_ellipse is True.

Notes

The aperture shape parameters are converted using the local WCS pixel scale evaluated at the first aperture position. Because aperture objects require scalar shape parameters, only a single reference position is used for the conversion. For apertures with multiple positions used with a WCS that has spatially-varying distortions, this may produce inaccurate results for positions far from the first position.

to_polygon(*, n_vertices=100)[source]#

Return a SkyPolygonAperture that approximates this circular aperture.

Parameters:
n_verticesint, optional

The number of polygon vertices used to approximate the circle. Must be at least 3. Default is 100.

Returns:
apertureSkyPolygonAperture

A sky polygon aperture that approximates the circle.