region_to_aperture#

photutils.aperture.region_to_aperture(region)[source]#

Convert a given regions.Region object to an Aperture object.

Parameters:
regionregions.Region

A supported regions.Region object.

Returns:
apertureAperture

An equivalent photutils aperture.

Raises:
TypeError

The given regions.Region object is not supported.

Notes

The following regions.Region objects are supported, shown with their equivalent Aperture 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)>