You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a developer trying to use this package. He has run up an issue trying to serialize a RectanglePixelRegion to CRTF
from astropy.coordinates import SkyCoord
from astropy import units as u
from regions import PixCoord
from regions import RectanglePixelRegion
region_pix = RectanglePixelRegion(center=PixCoord(x=42, y=43),
width=3, height=4,
angle=5 * u.deg)
region_pix.serialize(format='crtf')
fails with UnitConversionError: '' (dimensionless) and 'deg' (angle) are not convertible
The issue appears to arise at return serializer(regions, **kwargs) in serialize() in core/registry.py.
The issue is that kwargs is empty but _serialize_crtf(regions, coordsys='fk5', fmt='.6f', radunit='deg') which is called has a default unit of 'deg' which gets used in this case, even though it appears that the unit that should be used for the x value is empty/dimensionless.
The text was updated successfully, but these errors were encountered:
jrhosk
added a commit
to casangi/casagui
that referenced
this issue
Jul 26, 2022
… is used to convert the input mask discitonary into an astropy region in either pixel or world cooridates. Currently supported mask shapes are 'rect' and 'polygon'. For mor info see: https://astropy-regions.readthedocs.io/en/stable/shapes.html. In the future, this function needs to support return of 'crtf' format for use with tclean. Currently this is nort supported due to a bug in the pixel version of astropy regions (astropy/regions#471). A bug ticket has been opened.
Thanks, @dmehring. Yes, this is a bug in the API design and implementation of the CRTF serializer. It's on my radar to refactor the CRTF I/O functions. In the meantime, the workaround is to explicitly set the output coordinate frame to 'image', e.g,
We have a developer trying to use this package. He has run up an issue trying to serialize a RectanglePixelRegion to CRTF
fails with
UnitConversionError: '' (dimensionless) and 'deg' (angle) are not convertible
The issue appears to arise at
return serializer(regions, **kwargs)
inserialize()
in core/registry.py.The issue is that kwargs is empty but
_serialize_crtf(regions, coordsys='fk5', fmt='.6f', radunit='deg')
which is called has a default unit of 'deg' which gets used in this case, even though it appears that the unit that should be used for the x value is empty/dimensionless.The text was updated successfully, but these errors were encountered: