How to use the pyregion.parser_helper.wcs_shape function in pyregion

To help you get started, we’ve selected a few pyregion examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github astropy / pyregion / pyregion / ds9_region_parser.py View on Github external
StringEnd, ParseException)
from .region_numbers import CoordOdd, CoordEven, Distance, Angle, Integer
from .parser_helper import (wcs_shape, define_shape_helper, Shape, Global,
                            RegionPusher, define_expr, define_line,
                            CoordCommand,
                            comment_shell_like, define_simple_literals)
from .ds9_attr_parser import Ds9AttrParser, get_attr
from .wcs_converter import (convert_to_imagecoord,
                            convert_physical_to_imagecoord)

ds9_shape_defs = dict(
    circle=wcs_shape(CoordOdd, CoordEven, Distance),
    rotbox=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle),
    box=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle),
    polygon=wcs_shape(CoordOdd, CoordEven, repeat=(0, 2)),
    ellipse=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle, repeat=(2, 4)),
    annulus=wcs_shape(CoordOdd, CoordEven, Distance, repeat=(2, 3)),
    panda=wcs_shape(CoordOdd, CoordEven, Angle, Angle, Integer, Distance, Distance, Integer),
    pie=wcs_shape(CoordOdd, CoordEven,
                  Distance, Distance,
                  Angle, Angle),
    epanda=wcs_shape(CoordOdd, CoordEven,
                     Angle, Angle, Integer,
                     Distance, Distance, Distance,
                     Distance, Integer, Angle),
    bpanda=wcs_shape(CoordOdd, CoordEven,
                     Angle, Angle, Integer,
                     Distance, Distance, Distance,
                     Distance, Integer, Angle),
    point=wcs_shape(CoordOdd, CoordEven),
    line=wcs_shape(CoordOdd, CoordEven, CoordOdd, CoordEven),
    vector=wcs_shape(CoordOdd, CoordEven, Distance, Angle),
github astropy / pyregion / pyregion / ds9_region_parser.py View on Github external
RegionPusher, define_expr, define_line,
                            CoordCommand,
                            comment_shell_like, define_simple_literals)
from .ds9_attr_parser import Ds9AttrParser, get_attr
from .wcs_converter import (convert_to_imagecoord,
                            convert_physical_to_imagecoord)

ds9_shape_defs = dict(
    circle=wcs_shape(CoordOdd, CoordEven, Distance),
    rotbox=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle),
    box=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle),
    polygon=wcs_shape(CoordOdd, CoordEven, repeat=(0, 2)),
    ellipse=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle, repeat=(2, 4)),
    annulus=wcs_shape(CoordOdd, CoordEven, Distance, repeat=(2, 3)),
    panda=wcs_shape(CoordOdd, CoordEven, Angle, Angle, Integer, Distance, Distance, Integer),
    pie=wcs_shape(CoordOdd, CoordEven,
                  Distance, Distance,
                  Angle, Angle),
    epanda=wcs_shape(CoordOdd, CoordEven,
                     Angle, Angle, Integer,
                     Distance, Distance, Distance,
                     Distance, Integer, Angle),
    bpanda=wcs_shape(CoordOdd, CoordEven,
                     Angle, Angle, Integer,
                     Distance, Distance, Distance,
                     Distance, Integer, Angle),
    point=wcs_shape(CoordOdd, CoordEven),
    line=wcs_shape(CoordOdd, CoordEven, CoordOdd, CoordEven),
    vector=wcs_shape(CoordOdd, CoordEven, Distance, Angle),
    text=wcs_shape(CoordOdd, CoordEven),
)
github astropy / pyregion / pyregion / ds9_region_parser.py View on Github external
ellipse=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle, repeat=(2, 4)),
    annulus=wcs_shape(CoordOdd, CoordEven, Distance, repeat=(2, 3)),
    panda=wcs_shape(CoordOdd, CoordEven, Angle, Angle, Integer, Distance, Distance, Integer),
    pie=wcs_shape(CoordOdd, CoordEven,
                  Distance, Distance,
                  Angle, Angle),
    epanda=wcs_shape(CoordOdd, CoordEven,
                     Angle, Angle, Integer,
                     Distance, Distance, Distance,
                     Distance, Integer, Angle),
    bpanda=wcs_shape(CoordOdd, CoordEven,
                     Angle, Angle, Integer,
                     Distance, Distance, Distance,
                     Distance, Integer, Angle),
    point=wcs_shape(CoordOdd, CoordEven),
    line=wcs_shape(CoordOdd, CoordEven, CoordOdd, CoordEven),
    vector=wcs_shape(CoordOdd, CoordEven, Distance, Angle),
    text=wcs_shape(CoordOdd, CoordEven),
)

image_like_coordformats = ["image", "physical", "detector", "logical"]


class RegionParser(RegionPusher):

    def __init__(self):

        RegionPusher.__init__(self)

        self.shape_definition = ds9_shape_defs
        regionShape = define_shape_helper(self.shape_definition)
        regionShape = regionShape.setParseAction(lambda s, l, tok: Shape(tok[0], tok[1:]))
github astropy / pyregion / pyregion / ds9_region_parser.py View on Github external
ds9_shape_defs = dict(
    circle=wcs_shape(CoordOdd, CoordEven, Distance),
    rotbox=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle),
    box=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle),
    polygon=wcs_shape(CoordOdd, CoordEven, repeat=(0, 2)),
    ellipse=wcs_shape(CoordOdd, CoordEven, Distance, Distance, Angle, repeat=(2, 4)),
    annulus=wcs_shape(CoordOdd, CoordEven, Distance, repeat=(2, 3)),
    panda=wcs_shape(CoordOdd, CoordEven, Angle, Angle, Integer, Distance, Distance, Integer),
    pie=wcs_shape(CoordOdd, CoordEven,
                  Distance, Distance,
                  Angle, Angle),
    epanda=wcs_shape(CoordOdd, CoordEven,
                     Angle, Angle, Integer,
                     Distance, Distance, Distance,
                     Distance, Integer, Angle),
    bpanda=wcs_shape(CoordOdd, CoordEven,
                     Angle, Angle, Integer,
                     Distance, Distance, Distance,
                     Distance, Integer, Angle),
    point=wcs_shape(CoordOdd, CoordEven),
    line=wcs_shape(CoordOdd, CoordEven, CoordOdd, CoordEven),
    vector=wcs_shape(CoordOdd, CoordEven, Distance, Angle),
    text=wcs_shape(CoordOdd, CoordEven),
)

image_like_coordformats = ["image", "physical", "detector", "logical"]


class RegionParser(RegionPusher):

    def __init__(self):