Shape

class regions.Shape(coordsys, region_type, coord, meta, composite, include)[source]

Bases: object

Helper class to represent a DS9/CRTF Region.

This serves as intermediate step in the parsing process.

Parameters:
coordsys : str

Astropy Coordinate system frame used in the region.

region_type : str

Type of the region (as defined in this package).

coord : list of Angle or Quantity

Coordinates

meta : dict

Meta attributes

composite : bool

Composite region

include : bool

Include/exclude region

Attributes Summary

coordsys
region_type
shape_to_pixel_region
shape_to_sky_region

Methods Summary

check_crtf(self) Checks for CRTF compatibility.
check_ds9(self) Checks for DS9 compatibility.
convert_coords(self) Process list of coordinates
to_region(self) Converts to region, regions.Region object

Attributes Documentation

coordsys
region_type
shape_to_pixel_region = {'circle': <class 'regions.shapes.circle.CirclePixelRegion'>, 'circleannulus': <class 'regions.shapes.annulus.CircleAnnulusPixelRegion'>, 'ellipse': <class 'regions.shapes.ellipse.EllipsePixelRegion'>, 'ellipseannulus': <class 'regions.shapes.annulus.EllipseAnnulusPixelRegion'>, 'line': <class 'regions.shapes.line.LinePixelRegion'>, 'point': <class 'regions.shapes.point.PointPixelRegion'>, 'polygon': <class 'regions.shapes.polygon.PolygonPixelRegion'>, 'rectangle': <class 'regions.shapes.rectangle.RectanglePixelRegion'>, 'rectangleannulus': <class 'regions.shapes.annulus.RectangleAnnulusPixelRegion'>, 'text': <class 'regions.shapes.text.TextPixelRegion'>}
shape_to_sky_region = {'circle': <class 'regions.shapes.circle.CircleSkyRegion'>, 'circleannulus': <class 'regions.shapes.annulus.CircleAnnulusSkyRegion'>, 'ellipse': <class 'regions.shapes.ellipse.EllipseSkyRegion'>, 'ellipseannulus': <class 'regions.shapes.annulus.EllipseAnnulusSkyRegion'>, 'line': <class 'regions.shapes.line.LineSkyRegion'>, 'point': <class 'regions.shapes.point.PointSkyRegion'>, 'polygon': <class 'regions.shapes.polygon.PolygonSkyRegion'>, 'rectangle': <class 'regions.shapes.rectangle.RectangleSkyRegion'>, 'rectangleannulus': <class 'regions.shapes.annulus.RectangleAnnulusSkyRegion'>, 'text': <class 'regions.shapes.text.TextSkyRegion'>}

Methods Documentation

check_crtf(self)[source]

Checks for CRTF compatibility.

check_ds9(self)[source]

Checks for DS9 compatibility.

convert_coords(self)[source]

Process list of coordinates

This mainly searches for tuple of coordinates in the coordinate list and creates a SkyCoord or PixCoord object from them if appropriate for a given region type. This involves again some coordinate transformation, so this step could be moved to the parsing process

to_region(self)[source]

Converts to region, regions.Region object