EllipseAnnulusPixelRegion

class regions.EllipseAnnulusPixelRegion(center, inner_width, outer_width, inner_height, outer_height, angle=<Quantity 0. deg>, meta=None, visual=None)[source]

Bases: regions.shapes.annulus.AsymmetricAnnulusPixelRegion

A elliptical annulus in pixel coordinates.

Parameters:
center : PixCoord

The position of the center of the elliptical annulus.

inner_width : float

The inner width of the elliptical annulus (before rotation) in pixels

inner_height : float

The inner height of the elliptical annulus (before rotation) in pixels

outer_width : float

The outer width of the elliptical annulus (before rotation) in pixels

outer_height : float

The outer height of the elliptical annulus (before rotation) in pixels

angle : Quantity, optional

The rotation angle of the elliptical annulus, measured anti-clockwise. If set to zero (the default), the width axis is lined up with the x axis.

meta : RegionMeta object, optional

A dictionary which stores the meta attributes of this region.

visual : RegionVisual object, optional

A dictionary which stores the visual meta attributes of this region.

Examples

from astropy.coordinates import Angle
from regions import PixCoord, EllipseAnnulusPixelRegion
import matplotlib.pyplot as plt

x, y = 6, 6
inner_width = 5.5
inner_height = 3.5
outer_width = 8.5
outer_height = 6.5
angle = Angle("45deg")

fig, ax = plt.subplots(1, 1)

center = PixCoord(x=x, y=y)
reg = EllipseAnnulusPixelRegion(center=center, inner_width=inner_width,
                                inner_height=inner_height, outer_width=outer_width,
                                outer_height=outer_height, angle=angle)
patch = reg.as_artist(facecolor='none', edgecolor='red', lw=2)
ax.add_patch(patch)

plt.xlim(-5, 20)
plt.ylim(-5, 20)
ax.set_aspect('equal')

(Source code, png, hires.png, pdf)

../_images/regions-EllipseAnnulusPixelRegion-1.png

Methods Summary

to_sky(self, wcs) Returns a region defined in sky coordinates.

Methods Documentation

to_sky(self, wcs)[source]

Returns a region defined in sky coordinates.

Parameters:
wcs : WCS instance

The world coordinate system transformation to assume

Returns:
sky_region : SkyRegion object.