aperture_to_region#
- photutils.aperture.aperture_to_region(aperture)[source]#
Convert a given
Apertureobject to aregions.Regionorregions.Regionsobject.Because a
regions.Regionobject can only have one position, aregions.Regionsobject will be returned if the inputaperturehas more than one position. Otherwise, aregions.Regionobject will be returned.- Parameters:
- Returns:
- region
regions.Regionorregions.Regions An equivalent
regions.Regionobject. If the inputaperturehas more than one position then aregions.Regionswill be returned.
- region
Notes
The elliptical aperture
aandbparameters represent the semi-major and semi-minor axes, respectively. Theaandbparameters are mapped to the ellipsewidthandheightregion parameters, respectively, by multiplying by 2 because they represent the full extent of the ellipse.The region
anglefor sky-based regions is defined as the angle of thewidthaxis relative to WCS longitude axis (PA=90). However, the sky-based apertures define thethetaas the position angle of the semimajor axis relative to the North celestial pole (PA=0). Therefore, for sky-based apertures thethetaparameter is converted to the regionangleby adding 90 degrees.The following
Apertureobjects are supported, shown with their equivalentregions.Regionobject:Examples
>>> from photutils.aperture import CircularAperture, aperture_to_region >>> aperture = CircularAperture((10, 20), r=5) >>> region = aperture_to_region(aperture) >>> region <CirclePixelRegion(center=PixCoord(x=10.0, y=20.0), radius=5.0)>
>>> aperture = CircularAperture(((10, 20), (30, 40)), r=5) >>> region = aperture_to_region(aperture) >>> region <Regions([ <CirclePixelRegion(center=PixCoord(x=10.0, y=20.0), radius=5.0)>, <CirclePixelRegion(center=PixCoord(x=30.0, y=40.0), radius=5.0)> ])>