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

Read a DS9 region file in as a list of Region objects.

filename : str

The file path

errors : warn, ignore, strict, optional

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

regions : list

Python list of Region objects.


>>> from regions import read_ds9
>>> from import get_pkg_data_filename
>>> file = get_pkg_data_filename('data/physical_reference.reg', package='')
>>> regs = read_ds9(file, errors='warn')
>>> print(regs[0])
Region: CirclePixelRegion
center: PixCoord(x=330.0, y=1090.0)
radius: 40.0