ShapeList¶
-
class
pyregion.ShapeList(shape_list, comment_list=None)[source]¶ Bases:
listA list of
Shapeobjects.Parameters: shape_list : list
List of
pyregion.Shapeobjectscomment_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 :
HeaderFITS header
Returns: shape_list :
ShapeListNew 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
Trueif yes, andFalseif 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.HeaderFITS 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.ImageHDUFITS image HDU
header :
HeaderFITS header
shape : tuple
Image shape
Returns: mask :
numpy.arrayBoolean 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.
-