read_fits_region

regions.read_fits_region(filename, errors='strict')[source]

Reads a FITS region file and scans for any fits regions table and converts them into Region objects.

Parameters:
filename : str

The file path

errors : warn, ignore, strict

The error handling scheme to use for handling parsing errors. The default is ‘strict’, which will raise a FITSRegionParserError. warn will raise a FITSRegionParserWarning, and ignore will do nothing (i.e., be silent).

Returns:
regions : list

Python list of regions.Region objects.

Examples

>>> from astropy.utils.data import get_pkg_data_filename
>>> from regions import read_fits_region
>>> file_read = get_pkg_data_filename('data/fits_region.fits',
...                                   package='regions.io.fits.tests')
>>> regions = read_fits_region(file_read)