How to use the pyregion.core.ShapeList 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 / core.py View on Github external
Returns
        -------
        shape_list : `ShapeList`
            New shape list, with coordinates of the each shape
            converted to the image coordinate using the given header
            information.
        """

        comment_list = self._comment_list
        if comment_list is None:
            comment_list = cycle([None])

        r = RegionParser.sky_to_image(zip(self, comment_list),
                                      header)
        shape_list, comment_list = zip(*list(r))
        return ShapeList(shape_list, comment_list=comment_list)
github astropy / pyregion / pyregion / core.py View on Github external
----------
    region_string : str
        Region string

    Returns
    -------
    shapes : `ShapeList`
        List of `~pyregion.Shape`
    """
    rp = RegionParser()
    ss = rp.parse(region_string)
    sss1 = rp.convert_attr(ss)
    sss2 = _check_wcs(sss1)

    shape_list, comment_list = rp.filter_shape2(sss2)
    return ShapeList(shape_list, comment_list=comment_list)
github astropy / pyregion / pyregion / core.py View on Github external
----------
    s : str
        Region string

    Returns
    -------
    shapes : `ShapeList`
        List of `~pyregion.Shape`
    """
    rp = RegionParser()
    ss = rp.parse(s)
    sss1 = rp.convert_attr(ss)
    sss2 = _check_wcs(sss1)

    shape_list = rp.filter_shape(sss2)
    return ShapeList(shape_list)
github astropy / pyregion / pyregion / core.py View on Github external
header : `~astropy.io.fits.Header`
        FITS header

    Returns
    -------
    shapes : `~pyregion.ShapeList`
        List of `~pyregion.Shape`
    """
    rp = RegionParser()
    ss = rp.parse(s)
    sss1 = rp.convert_attr(ss)
    sss2 = _check_wcs(sss1)
    sss3 = rp.sky_to_image(sss2, header)

    shape_list = rp.filter_shape(sss3)
    return ShapeList(shape_list)
github astropy / pyregion / pyregion / core.py View on Github external
def __getitem__(self, key):
        if isinstance(key, slice):
            return ShapeList(list.__getitem__(self, key))
        else:
            return list.__getitem__(self, key)