diff --git a/docs/examples/calculate_moc_sky_area.py b/docs/examples/calculate_moc_sky_area.py new file mode 100644 index 00000000..919241d4 --- /dev/null +++ b/docs/examples/calculate_moc_sky_area.py @@ -0,0 +1,8 @@ +import numpy as np +import astropy.units as u +from mocpy import MOC + +ALL_SKY = 4 * np.pi * u.steradian +moc = MOC.from_string("0/0-11") # any other MOC instance will work +area = moc.sky_fraction * ALL_SKY +area = area.to(u.deg**2).value diff --git a/docs/examples/user_documentation.rst b/docs/examples/user_documentation.rst index 26bc4a45..86a4f1c9 100644 --- a/docs/examples/user_documentation.rst +++ b/docs/examples/user_documentation.rst @@ -93,6 +93,14 @@ By definition the MOC which has 100% of chance of containing a GW is the full sk .. plot:: examples/bayestar.py :include-source: +Calculate MOC sky area +~~~~~~~~~~~~~~~~~~~~~~ + +This example shows how to Calculate the sky area of a MOC instance. + +.. plot:: examples/calculate_moc_sky_area.py + :include-source: + Performing computation on the pixels of an FITS image lying in a MOC ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~