cds-astro / mocpy

Python library to easily create and manipulate MOCs (Multi-Order Coverage maps)
https://cds-astro.github.io/mocpy/
BSD 3-Clause "New" or "Revised" License
59 stars 33 forks source link

MOC.from_astropy_regions doesn't work with boxes with height > width #160

Closed hombit closed 2 months ago

hombit commented 2 months ago

It looks like mocpy assumes instances RectangleSkyRegion to have height smaller than width, so this code fails with ValueError: Semi-minor axis must be in ]0, a[:

from astropy.coordinates import Angle, SkyCoord
from mocpy import MOC
from regions import RectangleSkyRegion

region = RectangleSkyRegion(center=SkyCoord(0, 0, unit='deg'), width=Angle(1, 'deg'), height=Angle(2, 'deg'))
MOC.from_astropy_regions(region, max_depth=10)
ManonMarchand commented 2 months ago

Hi and thanks for reporting, This should be fixed in version 0.16.2 :slightly_smiling_face: