mocpy 0.21.0


pip install mocpy

  Latest version

Released: Oct 27, 2026


Meta
Author: Matthieu Baumann, Thomas Boch, Manon Marchand, F.-X. Pineau
Requires Python: >=3.10

Classifiers

Development Status
  • 4 - Beta

Programming Language
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: 3.15

License
  • OSI Approved :: BSD License

Topic
  • Scientific/Engineering :: Astronomy

Intended Audience
  • Science/Research
  • Education

MOCPy

PyPI version python Build/Test status Doc DOI

mocpy's logo

MOCPy is a Python library allowing easy creation and manipulation of MOCs (Multi-Order Coverage maps).

MOC is an IVOA standard enabling description of arbitrary sky, time, (or frequency) coverages.

What's in MOCpy?

Space Time Frequency
Space :white_check_mark: :white_check_mark: :white_check_mark:
Time :white_check_mark: :white_check_mark: :x:
Frequency :white_check_mark: :x: :white_check_mark:

There is support for one dimensional MOCs:

  • Space MOCs. The sky tesselation is based on the HEALPix sky tessellation, it maps regions of the sky into hierarchically grouped cells.
  • Time MOCs. The segmentation of the time axis is linear. This is described in the MOC standard since its version 2.0.
  • Frequency MOCs. :warning: this is not standard yet! The segmentation of the frequency axis is logarithmic. See [this IVOA presentation][https://wiki.ivoa.net/internal/IVOA/InterOpMay2023Apps/FMOC_IVOA_Bologne_Fernique.pdf] for a description.

But also these combinations:

  • Space-Time MOCs
  • Space-Frequency MOCs

a MOC plotted with MOCPy

Rendered with MOCpy!

Quick example

from mocpy import MOC
import astropy.units as u

# Create a MOC from a cone
field_of_view = MOC.from_cone(lon=0*u.deg, lat=0*u.deg, radius=10*u.deg, max_depth=7)

# Check if a position is covered
field_of_view.contains_lonlat(0*u.deg, 0*u.deg)  # True

# Combine MOCs with set operations
field_of_view2 = MOC.from_cone(lon=8*u.deg, lat=8*u.deg, radius=5*u.deg, max_depth=7)
coverage = field_of_view | field_of_view2

# Quick preview of the combined field of views
coverage.display_preview()

A quick display of the coverage. The two MOCs are combined into one.

Other resources

For a command line tool, see the moc-cli.

For more information about MOCPy's Rust core, see the moc crate

Installation

Latest stable version

  • from pip pip install mocpy
  • from conda conda install -c conda-forge mocpy

Unreleased latest version

To install MOCPy from this repository, make sure you have Python (https://www.python.org/downloads/) and Rust (https://www.rust-lang.org/tools/install) on your machine. Then, run

pip install git+https://github.com/cds-astro/mocpy.git

To run the notebooks

The example notebooks require additional dependencies. They can be installed with

pip install mocpy[notebooks]

Development installation

Contributions are very welcome. To build and test the library, clone this repository, make sure that you've got Rust on your machine (https://www.rust-lang.org/tools/install). Check that the Rust version you have is more recent than the minimal version declared in Cargo.toml under rust-version and do:

pip install pre-commit
pre-commit install
pip install maturin
maturin develop --release

And the library is ready to be edited. After a change on the Rust side, you'll have to do maturin develop --release again. If you only edit the python side, then a pip install . at the root of the repository will suffice.

We use pre-commit to keep consistent style conventions between all of us. This means that your commits will not pass if they require modifications. If this happens, do the required changes, git add the files again and attempt to commit again as usual.

To run the tests, do:

pip install .[dev]
python -m pytest

The tests that require to download remote data from external servers don't run by default. To execute them, do:

python -m pytest --run-remote

To check that the documentation builds. Make sure you have pandoc (https://pandoc.org/installing.html) and do:

pip install .[docs,plots]
cd docs
make clean html

The output will be in docs/_build/html.

For use in pyodide

Wheels that run in pyodide can be downloaded from each github's release for the module.

Other python packages for MOCs

0.21.0 Oct 27, 2026
0.20.0 Mar 10, 2026
0.19.1 Nov 07, 2025
0.19.0 Nov 05, 2025
0.18.0 May 26, 2025
0.17.1 Nov 22, 2024
0.17.0 Oct 17, 2024
0.16.2 Jul 26, 2024
0.16.1 Jul 18, 2024
0.16.0 Jul 16, 2024
0.15.0 Jun 26, 2024
0.14.0 Jun 03, 2024
0.13.1 Dec 04, 2023
0.13.0 Aug 29, 2023
0.12.3 Mar 06, 2023
0.12.2 Mar 02, 2023
0.12.1 Feb 28, 2023
0.12.0 Feb 13, 2023
0.11.0 Feb 04, 2022
0.10.0 Nov 16, 2021
0.9.0 Oct 19, 2021
0.8.5 Mar 18, 2021
0.8.4 Jul 10, 2020
0.8.3 Jun 04, 2020
0.8.2 Feb 21, 2020
0.8.1 Feb 17, 2020
0.8.0 Feb 13, 2020
0.7.4 Oct 04, 2019
0.7.3 Oct 02, 2019
0.7.2 Sep 17, 2019
0.7.1 Sep 09, 2019
0.7.0 Aug 07, 2019
0.6.1 Jun 14, 2019
0.6.0 Jun 13, 2019
0.5.7 May 24, 2019
0.5.6 Apr 11, 2019
0.5.5 Feb 13, 2019
0.5.4 Feb 07, 2019
0.5.3 Jan 30, 2019
0.5.2 Jan 28, 2019
0.5.1 Jan 25, 2019
0.5.0 Jan 16, 2019
0.4.9 Jul 16, 2018
0.4.8 Jul 16, 2018
0.4.7 Jul 04, 2018
0.4.6 Jul 02, 2018
0.4.5 Jun 26, 2018
0.4.4 May 30, 2018
0.4.3 May 25, 2018
0.4.2 May 22, 2018
0.4.1 May 18, 2018
0.4.0 May 18, 2018
0.3.6 Dec 12, 2017
0.3.5 Nov 18, 2016
0.3.4 Nov 18, 2016
0.3.3 Nov 18, 2016
0.3.2 Nov 18, 2016
0.3.1 Nov 18, 2016
0.2.9 May 19, 2016
0.2.8 May 19, 2016
0.2.7 Apr 26, 2016
0.2.5 Mar 30, 2016
0.2.2 Jan 11, 2016
0.2.1 Jan 11, 2016
0.2.0 Jan 11, 2016
0.1.81 Nov 30, 2015
0.1.9 Jan 11, 2016
0.1.8 Nov 30, 2015
0.1.7 Jun 11, 2015
0.1.6 Jun 11, 2015
0.1.4 May 29, 2015
0.1.3 May 29, 2015
0.1.2 May 28, 2015
0.1.1 May 28, 2015
0.1.1a0 May 28, 2015
0.1.0 May 28, 2015
0.1.0.dev0 May 28, 2015

Wheel compatibility matrix

Platform CPython >=3.10 (abi3) CPython 3.15 (abi3t) CPython >=3.15 (abi3)
macosx_10_12_x86_64
macosx_11_0_arm64
manylinux2014_aarch64
manylinux2014_armv7l
manylinux2014_i686
manylinux2014_ppc64le
manylinux2014_s390x
manylinux2014_x86_64
manylinux_2_17_aarch64
manylinux_2_17_armv7l
manylinux_2_17_i686
manylinux_2_17_ppc64le
manylinux_2_17_s390x
manylinux_2_17_x86_64
musllinux_1_2_aarch64
musllinux_1_2_armv7l
musllinux_1_2_i686
musllinux_1_2_x86_64
pyemscripten_2026_0_wasm32
win32
win_amd64
win_arm64

Files in release

mocpy-0.21.0-cp310-abi3-macosx_10_12_x86_64.whl (1.1MiB)
mocpy-0.21.0-cp310-abi3-macosx_11_0_arm64.whl (1.1MiB)
mocpy-0.21.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1MiB)
mocpy-0.21.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.2MiB)
mocpy-0.21.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (1.4MiB)
mocpy-0.21.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.4MiB)
mocpy-0.21.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.3MiB)
mocpy-0.21.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2MiB)
mocpy-0.21.0-cp310-abi3-musllinux_1_2_aarch64.whl (1.3MiB)
mocpy-0.21.0-cp310-abi3-musllinux_1_2_armv7l.whl (1.5MiB)
mocpy-0.21.0-cp310-abi3-musllinux_1_2_i686.whl (1.5MiB)
mocpy-0.21.0-cp310-abi3-musllinux_1_2_x86_64.whl (1.4MiB)
mocpy-0.21.0-cp310-abi3-pyemscripten_2026_0_wasm32.whl (654.8KiB)
mocpy-0.21.0-cp310-abi3-win32.whl (1.1MiB)
mocpy-0.21.0-cp310-abi3-win_amd64.whl (1.2MiB)
mocpy-0.21.0-cp310-abi3-win_arm64.whl (1.1MiB)
mocpy-0.21.0-cp315-abi3.abi3t-macosx_10_12_x86_64.whl (1.1MiB)
mocpy-0.21.0-cp315-abi3.abi3t-macosx_11_0_arm64.whl (1.1MiB)
mocpy-0.21.0-cp315-abi3.abi3t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1MiB)
mocpy-0.21.0-cp315-abi3.abi3t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.2MiB)
mocpy-0.21.0-cp315-abi3.abi3t-manylinux_2_17_i686.manylinux2014_i686.whl (1.4MiB)
mocpy-0.21.0-cp315-abi3.abi3t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.4MiB)
mocpy-0.21.0-cp315-abi3.abi3t-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.2MiB)
mocpy-0.21.0-cp315-abi3.abi3t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2MiB)
mocpy-0.21.0-cp315-abi3.abi3t-musllinux_1_2_aarch64.whl (1.3MiB)
mocpy-0.21.0-cp315-abi3.abi3t-musllinux_1_2_armv7l.whl (1.5MiB)
mocpy-0.21.0-cp315-abi3.abi3t-musllinux_1_2_i686.whl (1.5MiB)
mocpy-0.21.0-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl (1.4MiB)
mocpy-0.21.0-cp315-abi3.abi3t-win32.whl (1.1MiB)
mocpy-0.21.0-cp315-abi3.abi3t-win_amd64.whl (1.1MiB)
mocpy-0.21.0-cp315-abi3.abi3t-win_arm64.whl (1.1MiB)
mocpy-0.21.0.tar.gz (110.9KiB)
Extras:
Dependencies:
astropy
numpy