region_to_aperture#
- photutils.aperture.region_to_aperture(region)[source]#
Convert a given
regions.Regionobject to anApertureobject.- Parameters:
- region
regions.Region A supported
regions.Regionobject.
- region
- Returns:
- aperture
Aperture An equivalent
photutilsaperture.
- aperture
- Raises:
TypeErrorThe input is not a
regions.Regionobject, or the givenregions.Regionobject is not supported.
Notes
The ellipse
widthandheightregion 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 semimajor (a) and semiminor (b) axes. Thewidthandheightparameters are mapped to the semimajor (a) and semiminor (b) axes parameters, respectively, of the elliptical apertures.The region
anglefor sky-based regions is defined as the angle of thewidthaxis relative to the WCS longitude axis (PA=90). However, the sky-based apertures definethetaas the position angle, relative to the North celestial pole (PA=0), of the semimajor axis (elliptical apertures) or of the width side (rectangular apertures). Therefore, for sky-based elliptical and rectangular regions the regionangleis converted to the aperturethetaparameter by subtracting 90 degrees.The following
regions.Regionobjects are supported, shown with their equivalentApertureobject: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)>