Closed registerrier closed 2 years ago
This appears to always have been the behavior. For example, these are the equivalent commands using regions v0.4:
>>> from regions import DS9Parser
>>> regions_str = '# Region file format: DS9\nimage\ncircle(147.10,254.17,3.1) # color=green\n'
>>> parser = DS9Parser(regions_str)
>>> regions = parser.shapes.to_regions()
>>> print(regions[0].meta)
{'include': True}
>>> from regions import fits_region_objects_to_table
>>> from regions import FITSRegionParser
>>> table = fits_region_objects_to_table(regions)
>>> parser = FITSRegionParser(table)
>>> regions = parser.shapes.to_regions()
>>> print(regions[0].meta)
{'tag': '1', 'include': False}
I need to check how the include
metadata flag is used in FITS region format specification. Note that there is not a one-to-one correspondence of all the meta features of the three different region file formats. Because of this, the serialization step may need to drop unsupported region metadata. In those cases, we should warn the user.
As far as I know, in the FITS regions specification document, the exclude
flag is handled by adding a !
character at the beginning of the SHAPE
string.
I've fixed this in #444. Parsed FITS regions will now have "include = 0" in their metadata if the shape is prefixed with '!'. Shapes without '!' will not have include
in their metadata.
With regions v0.5, some meta properties of regions are not correctly handled by
Regions.serialize
/Regions.parse
with fits format.See the following example:
The
include
meta entry should be set toTrue
.