DS9RegionParser

class regions.DS9RegionParser(coordsys, include, region_type, region_end, global_meta, line)[source]

Bases: object

Parse a DS9 region string

This will turn a line containing a DS9 region into a Shape

Parameters:
coordsys : str

Coordinate system

include : str {‘’, ‘-‘}

Flag at the beginning of the line

region_type : str

Region type

region_end : int

Coordinate of the end of the regions name, this is passed in order to handle whitespaces correctly

global_meta : dict

Global meta data

line : str

Line to parse

Attributes Summary

coordinate_units
language_spec
letter

Methods Summary

convert_coordinates(self) Convert coordinate string to objects
convert_meta(self) Convert meta string to dict
make_shape(self) Make shape object
parse(self) Convert line to shape object
parse_composite(self) Determine whether the region is composite
split_line(self) Split line into coordinates and meta string

Attributes Documentation

coordinate_units = {'fk4': ('hour_or_deg', Unit("deg")), 'fk5': ('hour_or_deg', Unit("deg")), 'galactic': (Unit("deg"), Unit("deg")), 'geocentrictrueecliptic': (Unit("deg"), Unit("deg")), 'icrs': ('hour_or_deg', Unit("deg")), 'image': (Unit(dimensionless), Unit(dimensionless)), 'physical': (Unit(dimensionless), Unit(dimensionless)), 'wcs': (Unit(dimensionless), Unit(dimensionless)), 'wcsa': (Unit(dimensionless), Unit(dimensionless)), 'wcsb': (Unit(dimensionless), Unit(dimensionless)), 'wcsc': (Unit(dimensionless), Unit(dimensionless)), 'wcsd': (Unit(dimensionless), Unit(dimensionless)), 'wcse': (Unit(dimensionless), Unit(dimensionless)), 'wcsf': (Unit(dimensionless), Unit(dimensionless)), 'wcsg': (Unit(dimensionless), Unit(dimensionless)), 'wcsh': (Unit(dimensionless), Unit(dimensionless)), 'wcsi': (Unit(dimensionless), Unit(dimensionless)), 'wcsj': (Unit(dimensionless), Unit(dimensionless)), 'wcsk': (Unit(dimensionless), Unit(dimensionless)), 'wcsl': (Unit(dimensionless), Unit(dimensionless)), 'wcsm': (Unit(dimensionless), Unit(dimensionless)), 'wcsn': (Unit(dimensionless), Unit(dimensionless)), 'wcso': (Unit(dimensionless), Unit(dimensionless)), 'wcsp': (Unit(dimensionless), Unit(dimensionless)), 'wcsq': (Unit(dimensionless), Unit(dimensionless)), 'wcsr': (Unit(dimensionless), Unit(dimensionless)), 'wcss': (Unit(dimensionless), Unit(dimensionless)), 'wcst': (Unit(dimensionless), Unit(dimensionless)), 'wcsu': (Unit(dimensionless), Unit(dimensionless)), 'wcsv': (Unit(dimensionless), Unit(dimensionless)), 'wcsw': (Unit(dimensionless), Unit(dimensionless)), 'wcsx': (Unit(dimensionless), Unit(dimensionless)), 'wcsy': (Unit(dimensionless), Unit(dimensionless)), 'wcsz': (Unit(dimensionless), Unit(dimensionless))}
language_spec = {'annulus': <itertools.chain object>, 'box': (<function CoordinateParser.parse_coordinate>, <function CoordinateParser.parse_coordinate>, <function CoordinateParser.parse_angular_length_quantity>, <function CoordinateParser.parse_angular_length_quantity>, <function CoordinateParser.parse_angular_length_quantity>), 'circle': (<function CoordinateParser.parse_coordinate>, <function CoordinateParser.parse_coordinate>, <function CoordinateParser.parse_angular_length_quantity>), 'ellipse': <itertools.chain object>, 'line': (<function CoordinateParser.parse_coordinate>, <function CoordinateParser.parse_coordinate>, <function CoordinateParser.parse_coordinate>, <function CoordinateParser.parse_coordinate>), 'point': (<function CoordinateParser.parse_coordinate>, <function CoordinateParser.parse_coordinate>), 'polygon': <itertools.cycle object>, 'text': (<function CoordinateParser.parse_coordinate>, <function CoordinateParser.parse_coordinate>)}
letter = 'z'

Methods Documentation

convert_coordinates(self)[source]

Convert coordinate string to objects

convert_meta(self)[source]

Convert meta string to dict

make_shape(self)[source]

Make shape object

parse(self)[source]

Convert line to shape object

parse_composite(self)[source]

Determine whether the region is composite

split_line(self)[source]

Split line into coordinates and meta string