region_to_aperture#
- photutils.aperture.region_to_aperture(region)[source]#
Convert a given
regions.Region
object to anAperture
object.- Parameters:
- region
regions.Region
A supported
regions.Region
object.
- region
- Returns:
- aperture
Aperture
An equivalent
photutils
aperture.
- aperture
- Raises:
TypeError
The given
regions.Region
object is not supported.
Notes
The ellipse
width
andheight
region parameters represent the full extent of the shapes and thus are divided by 2 when converting to elliptical aperture objects, which are defined using the semi-major (a
) and semi-minor (b
) axes. Thewidth
andheight
parameters are mapped to the the semi-major (a
) and semi-minor (b
) axes parameters, respectively, of the elliptical apertures.The region
angle
for sky-based regions is defined as the angle of thewidth
axis relative to WCS longitude axis (PA=90). However, the sky-based apertures define thetheta
as the position angle of the semimajor axis relative to the North celestial pole (PA=0). Therefore, for sky-based regions the regionangle
is converted to the aperturetheta
parameter by subtracting 90 degrees.The following
regions.Region
objects are supported, shown with their equivalentAperture
object:Examples
>>> from regions import CirclePixelRegion, PixCoord >>> from photutils.aperture import region_to_aperture >>> region = CirclePixelRegion(center=PixCoord(x=10, y=20), radius=5) >>> aperture = region_to_aperture(region) >>> aperture <CircularAperture([10., 20.], r=5.0)>