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

Support regions.Regions #163

Closed hombit closed 2 weeks ago

hombit commented 1 month ago

Currently MOC.from_astropy_region supports individual region objects from astropy-regions library, but not a collection of them provided by regions.Regions. It would be great to have a performant way to build a single MOC from it

ManonMarchand commented 1 month ago

Sure!

As the list of MOCs is also useful. I think the API would look like

MOC.from_astropy_region(my_regions, single_moc=True)

And we could also add the single_moc argument in the other multimoc creation methods. What do you think @fxpineau ?

EDIT: or union=True which is a bit more explicit?

ManonMarchand commented 2 weeks ago

Will do, but a more efficient way will be implemented as an option for from_cones (strategy for non-overlapping cones already merged in master, second strategy for overlaping cones will be added later) and from_boxes