ShapeList¶
-
class
pyregion.
ShapeList
(shape_list, comment_list=None)[source]¶ Bases:
list
A list of
Shape
objects.Parameters: shape_list : list
List of
pyregion.Shape
objectscomment_list : list, None
List of comment strings for each argument
Methods Summary
as_imagecoord
(header)New shape list in image coordinates. check_imagecoord
()Are all shapes in image coordinates? get_filter
([header, origin])Get filter. get_mask
([hdu, header, shape])Create a 2-d mask. get_mpl_patches_texts
([properties_func, ...])Often, the regions files implicitly assume the lower-left corner of the image as a coordinate (1,1). write
(outfile)Write this shape list to a region file. Methods Documentation
-
as_imagecoord
(header)[source]¶ New shape list in image coordinates.
Parameters: header :
Header
FITS header
Returns: shape_list :
ShapeList
New shape list, with coordinates of the each shape converted to the image coordinate using the given header information.
-
check_imagecoord
()[source]¶ Are all shapes in image coordinates?
Returns
True
if yes, andFalse
if not.
-
get_filter
(header=None, origin=1)[source]¶ Get filter. Often, the regions files implicitly assume the lower-left corner of the image as a coordinate (1,1). However, the python convetion is that the array index starts from 0. By default (
origin=1
), coordinates of the returned mpl artists have coordinate shifted by (1, 1). If you do not want this shift, useorigin=0
.Parameters: header :
astropy.io.fits.Header
FITS header
origin : {0, 1}
Pixel coordinate origin
Returns: filter : TODO
Filter object
-
get_mask
(hdu=None, header=None, shape=None)[source]¶ Create a 2-d mask.
Parameters: hdu :
astropy.io.fits.ImageHDU
FITS image HDU
header :
Header
FITS header
shape : tuple
Image shape
Returns: mask :
numpy.array
Boolean mask
Examples
get_mask(hdu=f[0]) get_mask(shape=(10,10)) get_mask(header=f[0].header, shape=(10,10))
-
get_mpl_patches_texts
(properties_func=None, text_offset=5.0, origin=1)[source]¶ Often, the regions files implicitly assume the lower-left corner of the image as a coordinate (1,1). However, the python convetion is that the array index starts from 0. By default (
origin=1
), coordinates of the returned mpl artists have coordinate shifted by (1, 1). If you do not want this shift, useorigin=0
.
-