CRTFRegionParser

class regions.CRTFRegionParser(global_meta, include, type_, region_type, reg_str, meta_str, errors='strict')[source]

Bases: object

Parse a CRTF region string

This will turn a line containing a CRTF region into a Shape object.

Parameters:
global_meta : dict

Global meta data of the CRTF file which is used as default meta values for regions

include : str {‘+’, ‘-‘}

Flag at the beginning of the line

type_ : str {‘reg’, ‘ann’}

Kind of the region definition

region_type : str

Region type

reg_str : str

Region string to parse

meta_str : str

Meta string to parse

errors : warn, ignore, strict, optional

The error handling scheme to use for handling parsing errors. The default is ‘strict’, which will raise a CRTFRegionParserError. warn will raise a CRTFRegionParserWarning, and ignore will do nothing (i.e., be silent).

Attributes Summary

coordinate_systems
coordsys_mapping
language_spec

Methods Summary

convert_coordinates(self) Convert coordinate string to Angle or Quantity objects
convert_meta(self) Parses the meta_str to python dictionary and stores in meta attribute.
make_shape(self) Make shape object
parse(self) Starting point to parse the CRTF region string.
set_coordsys(self) Mapping to astropy’s coordinate system name

Attributes Documentation

coordinate_systems = ['j2000', 'icrs', 'galactic', 'supergal', 'image', 'ecliptic']
coordsys_mapping = {'altaz': 'altaz', 'b1950': 'fk4', 'barycentricmeanecliptic': 'barycentricmeanecliptic', 'barycentrictrueecliptic': 'barycentrictrueecliptic', 'cirs': 'cirs', 'custombarycentricecliptic': 'custombarycentricecliptic', 'ecliptic': 'geocentrictrueecliptic', 'fk4': 'fk4', 'fk4noeterms': 'fk4noeterms', 'fk5': 'fk5', 'galactic': 'galactic', 'galacticlsr': 'galacticlsr', 'galactocentric': 'galactocentric', 'gcrs': 'gcrs', 'geocentricmeanecliptic': 'geocentricmeanecliptic', 'geocentrictrueecliptic': 'geocentrictrueecliptic', 'hcrs': 'hcrs', 'heliocentriceclipticiau76': 'heliocentriceclipticiau76', 'heliocentricmeanecliptic': 'heliocentricmeanecliptic', 'heliocentrictrueecliptic': 'heliocentrictrueecliptic', 'icrs': 'icrs', 'itrs': 'itrs', 'j2000': 'fk5', 'lsr': 'lsr', 'precessedgeocentric': 'precessedgeocentric', 'supergal': 'supergalactic', 'supergalactic': 'supergalactic'}
language_spec = {'annulus': ['c', 'pl'], 'box': ['c', 'c'], 'centerbox': ['c', 'pl'], 'circle': ['c', 'l'], 'ellipse': ['c', 'pl', 'l'], 'line': ['c', 'c'], 'poly': <itertools.cycle object>, 'rotbox': ['c', 'pl', 'l'], 'symbol': ['c', 's'], 'text': ['c', 's'], 'vector': ['c', 'c']}

Methods Documentation

convert_coordinates(self)[source]

Convert coordinate string to Angle or Quantity objects

convert_meta(self)[source]

Parses the meta_str to python dictionary and stores in meta attribute.

make_shape(self)[source]

Make shape object

parse(self)[source]

Starting point to parse the CRTF region string.

set_coordsys(self)[source]

Mapping to astropy’s coordinate system name

# TODO: needs expert attention (Most reference systems are not mapped)