Closed mcoughlin closed 4 months ago
You can do
from mocpy import MOC
MOC.from_string("0/0-11").sky_fraction
1.0
If you want something in sq-deg, there is a nice way to do so by making use of astropy.units and the sky_fraction method of a moc
import astropy.units as u
from mocpy import MOC
moc = MOC.from_string("0/0-11") # any other MOC instance will work
ALL_SKY = 4 * np.pi * u.steradian
area = moc.sky_fraction * ALL_SKY
area = area.to(u.deg**2).value
Better, thanks! Would you be interested in contributing your snippet to the documentation? (I can also do it if you prefer) This could go well as a new subsection here: https://github.com/cds-astro/mocpy/blob/a32c9a199ddc74887d0566b7c78e34e6d4c66043/docs/examples/user_documentation.rst?plain=1#L28
Yes, I would be happy to contribute! I will create a PR with this example.
Perfect, thanks!
It wasn't immediately clear from the docs how to get the sky area covered by the MOC. I would guess there is a MOC.area() equivalent somewhere but I do not see it?