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
56 stars 32 forks source link

Max, min, median, average Distance in a region #144

Open santier14 opened 1 week ago

santier14 commented 1 week ago

Hello simiar to probabilities_in_multiordermap(moc,skymap), is it possible to have a function distance_in_multiordermap(moc2,skymap) for GW alerts, because the map is 3D with a distance per pixel in it. Thanks

fxpineau commented 1 week ago

When computing the min/max, if a cell of the multi-order map is partially covered by a MOC, would you ignore or take into account the value (the distance in your case) it contains? For the mean/median, would you consider each value with a weight of 1 or would you like to apply a weight which depends on the surface area of the part of multi-order map cells covered by the MOC? Also, we just made a new MOCPy release, would you have other requirements?

MPillas commented 1 week ago

Hello @fxpineau, I am working with @santier14. If possible, I would consider the value if it is partially covered. For the weights, I think the best in our case would be to return both the associated distance and the weight that depends on the surface area of the part of multi-order map cells covered by the MOC. Is that possible? Thanks!

fxpineau commented 1 week ago

Hi @MPillas,

If I understand correctly, from an API point-of-view, you would like a method MOC.multiordermap_values_and_weigths(self, multiordermap: Table, column: str) returning a numpy table made of 2 columns:

Then, you will be able to compute the min/max/mean/weithed mean/median/... on your side. Does that sound good?

MPillas commented 1 week ago

That would be great, thanks !

fxpineau commented 1 week ago

First implementation (to be tested) made in the Rust part of the code:

MPillas commented 4 days ago

@fxpineau Does this commit have been merged so we can use it?

ManonMarchand commented 4 days ago

Hello, only the rust part is merged for now. We'll do the python port soon

fxpineau commented 3 days ago

@ManonMarchand I just added a method multiorder_filter_mask_in_smoc on the Rust part of the code, see this commit. (Since I added a method in the master of moc-lib-rust, be careful with the cargo cache ;) )