Skip to main content

cloelib – The Library for the Cosmology Likelihood for Observables in Euclid

cloelib is a flexible and efficient library designed to compute cosmological observables for the CLOE (Cosmology Likelihood for Observables in Euclid) project. It is built for seamless integration with Boltzmann solvers and JAX-based frameworks, enabling automatic differentiation and modularity for the next generation of cosmological analyses.

We welcome feedback from the Euclid community and beyond to refine and improve this library!

arXiv CI Docs pre-commit Tests: pytest codecov Linting: Ruff Code Style: Prettier Type Checking: ty PyPI version fair-software.eu FAIR checklist badge CRediT All Contributors


📖 Table of Contents


✨ Features

🔹 Intuitive & User-Friendly – Generate Euclid-like observables (e.g., power spectra, window functions, and tracer statistics) in just 3 minutes!

🔹 Automatic Differentiation – Includes a toy-example with JAX for gradient-based computations.

🔹 Modular & Extensible –

  • Easily interface with external Boltzmann solvers or emulators via Python Protocols following the cosmology.API.
  • Core structure enables defining Background & Perturbation models, choosing observables via Tracer or SpectroPower protocols, and computing final summary statistics like angular power spectra or Legendre multipoles.

📂 Supported external codes

cloelib interfaces with the following external codes, each used by a specific internal module for its calculations:

Background Perturbations SpectroPower
camb camb comet-emu
class class pbjcosmo
mochi_class HMCode2020emu NA
mgclass cosmopower-jax NA
NA euclidemu2 NA
NA BACCOemu NA
NA e-MANTIS NA
NA FlamingoBaryonResponseEmulator NA

We do not provide installation support for PBJ.

Optional Dependencies

Several optional dependencies enhance cloelib capabilities:

  • pyinstrument – Time profiling for performance optimization
  • pylevin, mpmath – Required for specific observational probes (i.e: COSEBIs)
  • tensorflow – Needed for certain emulator backends (i.e: HMCode2020emu)
  • baccoemu – Required for BACCOemu nonlinear and baryonic perturbations
  • FlamingoBaryonResponseEmulator – Required for FLAMINGO baryonic suppression

These are not included in the default installation but can be installed as shown below.


🚀 Installation

Quick Start 🎯

  1. Set up your environment – Create a fresh conda/mamba environment using the cloe-org-environments repository.

  2. Install cloelib - Get the core library up and running:

  • Directly from PyPI (no clone needed):
pip install cloelib

or

  • Clone cloelib:
git clone https://github.com/cloe-org/cloelib.git
cd cloelib
  • Check out the latest release (optional but recommended):
git checkout <latest-tag>  # Find tags in "Releases"
  • And install cloelib:
pip install .
  1. Add optional superpowers – Enhance with external dependencies and tools:
  • If cloelib installed with PyPI:
pip install camb classy comet-emu euclidemu2 pylevin mpmath tensorflow tf-keras cosmopower-jax baccoemu hiclassy emantis pbjcosmo fastpt react mgclassy FlamingoBaryonResponseEmulator
  • If cloelib installed from the local clone:
pip install .[camb,classy,comet-emu,euclidemu2,pylevin,mpmath,tensorflow,tf-keras,cosmopower-jax,baccoemu,hiclassy,emantis,pbjcosmo,fastpt,react,mgclassy,FlamingoBaryonResponseEmulator]

💡 Pro Tip: Some shells struggle with brackets. Try quotes if needed:

pip install ."[camb,classy,comet-emu,euclidemu2,pylevin,mpmath,tensorflow,tf-keras,cosmopower-jax,baccoemu,hiclassy,emantis,pbjcosmo,fastpt,react,mgclassy,FlamingoBaryonResponseEmulator]"

The react extra installs the TensorFlow support needed by the ReACT modified-gravity boost module; MGEmu itself is installed in step 5.

  1. Install backends not available on PyPI – HMcode2020Emu, MGEmu (needed by the react module) and mochi_class are only distributed from GitHub, so they cannot be declared as extras of a package published on PyPI. Install the ones you need directly:
pip install "HMcode2020Emu @ git+https://github.com/MariaTsedrik/HMcode2020Emu.git"
pip install "MGemu @ git+https://github.com/nebblu/MGEmus.git"
pip install "mochi_classy @ git+https://github.com/mcataneo/mochi_class_public.git@mochi_classy"

You're all set! 🎉 Ready to compute cosmological observables.


📊 Usage

Explore the tutorials in the cloe-org/playground repository for examples on how to compute cosmological observables and other key quantities!


🤝 Contributing

Please review the organization's general contribution guidelines and the specific guidelines for this repository in the CONTRIBUTING.md file. Once you're familiar with the guidelines, follow these steps:

1️⃣ Create a new branch:

git checkout -b feature/your-feature-name

2️⃣ Implement your changes following project style guidelines.

3️⃣ Commit your modifications:

git commit -m "Add feature: [brief description]"

4️⃣ Push your branch:

git push origin feature/your-feature-name

5️⃣ Open a pull request and contribute to the project!


📚 Citation

If you use cloelib in your research, please cite the software using the metadata in CITATION.cff. On GitHub, select Cite this repository to copy the citation in APA or BibTeX format.

Other contributions are acknowledged in the contributors section.

📜 License

This project is licensed under the MIT LICENSE – see the LICENSE file for details.


🙏 Acknowledgements

🔭 Inspired by the pioneering work of the Euclid Consortium CLOE software and the jaxcosmo project.

👩‍💻🧑‍💻 Authored by M. Bonici, G. Cañas-Herrera, P. Carrilho, S. Casas, C. Moretti, and A. Pezzotta (listed in alphabetical order).

🎯 With technical advice from S. Farrens and N. Tessore.

🤝 Contributors

This project follows the all-contributors specification. Contributions of any kind are welcome!

Alex Hall
Alex Hall

🐛 🤔 🧑‍🏫
itutusaus
itutusaus

👀 📆 🧑‍🏫 📣
Laila Linke
Laila Linke

💻
David Navarro Gironés
David Navarro Gironés

📖 💻 👀 🐛
stefanodavini
stefanodavini

💻 📖 ⚠️ 🤔 🔧
Guadalupe Cañas-Herrera
Guadalupe Cañas-Herrera

💻 🚧 🤔 🐛 🖋 🔣 📖 🚇 📆 💬 ⚠️ 📢
Marco Bonici
Marco Bonici

💻 🚧 🤔 🐛 🖋 📖 🚇 📆 💬 ⚠️ 📢
Chiara Moretti
Chiara Moretti

💻 🚧 🤔 🐛 🖋 📖 📢
AndreaPezzotta
AndreaPezzotta

💻 🚧 🤔 🐛 🖋 🔣 📖 📢
Santiago Casas
Santiago Casas

💻 🚧 🤔 👀 🐛 📖
Pedro Carrilho
Pedro Carrilho

💻 🚧 🤔 🐛 🖋 🔣 📖 📢 👀
Nicolas Tessore
Nicolas Tessore

🔧 🧑‍🏫 💻 👀 🐛
Samuel Farrens
Samuel Farrens

🔧 🧑‍🏫 💻 👀
Jose Coloma Nadal
Jose Coloma Nadal

🐛 💻 🤔 👀
Casper Vedder
Casper Vedder

💻 🤔 🐛 👀 🧑‍🏫
Ben Bose
Ben Bose

💻
Dida Markovic
Dida Markovic

🤔 💬
Michel Aguena
Michel Aguena

💻 ⚠️ 🤔 📖
Filippo Oppizzi
Filippo Oppizzi

💻 🤔 🔧
Jaime RZ
Jaime RZ

🤔
Arthur Loureiro
Arthur Loureiro

💻 🤔 📖 👀 🐛
Pierre Burger
Pierre Burger

💻 🤔
Davide Sciotti
Davide Sciotti

🐛 🤔 🧑‍🏫
GabrieleParimbelli
GabrieleParimbelli

🐛
Zahra Baghkhani
Zahra Baghkhani

💻 🤔 🐛
Fabrice Roy
Fabrice Roy

📖 💻 🤔
pltaylor16
pltaylor16

💻 📖
Robert Reischke
Robert Reischke

🤔 🧑‍🏫
Angus H. Wright
Angus H. Wright

🤔 🧑‍🏫
Matteo Baratto
Matteo Baratto

💻 🤔
Maria Tsedrik
Maria Tsedrik

💻 🤔
Arghavan Souki
Arghavan Souki

🐛 📖
Ryusei Kano
Ryusei Kano

💻 🤔
Linus Thummel
Linus Thummel

💻 📖 🤔 👀
Lisa Goh
Lisa Goh

💻 📖 🤔
zsirap
zsirap

💻 🤔 🐛
Konstantinos Tanidis
Konstantinos Tanidis

💻
Chaitanya
Chaitanya

💻 🐛 👀
raphkou
raphkou

🐛 💻 🤔 📖 👀
Ivan Sladoljev
Ivan Sladoljev

💻 🤔
NastassiaG
NastassiaG

💻 🐛 🤔
Martin Crocce
Martin Crocce

📆 🧑‍🏫 📣 🤔 🐛
CarmelitaCarbone
CarmelitaCarbone

📆 🧑‍🏫 📣
Giovanni
Giovanni

💻 🤔 📖
Jeger Broxterman
Jeger Broxterman

💻 🤔
Matthieu Schaller
Matthieu Schaller

🤔 🧑‍🏫 🐛
joezuntz
joezuntz

🧑‍🏫 🤔
KlaraBertmann
KlaraBertmann

💻 🤔
Anna Porredon
Anna Porredon

🤔 🧑‍🏫
emiliobellini
emiliobellini

🚧 🤔
Miguel Zumalacarregui
Miguel Zumalacarregui

🚧 🤔
Iñigo Sáez Casares
Iñigo Sáez Casares

💻 🤔
Neel Shah
Neel Shah

💻 🤔 🐛
Felicitas Keil
Felicitas Keil

💻 🤔
Jip de Buck
Jip de Buck

📓
Hironao Miyatake
Hironao Miyatake

🤔
Martin Kärcher
Martin Kärcher

💻 🤔
Chiara De Leo
Chiara De Leo

👀 🧑‍🏫 🐛
Yu-Ting
Yu-Ting

💻
Pau Tallada Crespí
Pau Tallada Crespí

🤔 💻 🐛
Shun-Sheng Li
Shun-Sheng Li

💻 🐛
amandinelebrun
amandinelebrun

👀
Sankarshana Srinivasan
Sankarshana Srinivasan

💻
zuzannakr
zuzannakr

💻 🚧 🐛 📖
Guillermo Franco Abellán
Guillermo Franco Abellán

💻 🤔
Giorgio Francesco Lesci
Giorgio Francesco Lesci

💻 🤔
AlessandraFumagalli
AlessandraFumagalli

💻 🤔
MCostanzi
MCostanzi

💻 🤔
Elisa Chisari
Elisa Chisari

🧑‍🏫 🤔
William D'Assignies Doumerg
William D'Assignies Doumerg

💻 🤔
marioballardini
marioballardini

🧑‍🏫
Sacha Guerrini
Sacha Guerrini

🐛
Vilasini Tinnaneri
Vilasini Tinnaneri

💻 🤔
Alessio Spurio Mancini
Alessio Spurio Mancini

👀

Metadata

Release files for cloelib 0.11.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloelib 0.11.1
File Size Uploaded Provenance Actions
cloelib-0.11.1.tar.gz 430.7 kB With provenance Details for cloelib-0.11.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cloelib 0.11.1
File Interpreter ABI Platform Actions
cloelib-0.11.1-py3-none-any.whl Python 3 none any Details for cloelib-0.11.1-py3-none-any.whl

Total release size: 683.0 kB

Release files / cloelib-0.11.1.tar.gz

Download URL cloelib-0.11.1.tar.gz
Size 430.7 kB
Tags Source
SHA-256 checksum
How to use checksums
32ce6d9a93c48bedb63be6cb3890b9b1cdffdf683f414548ad765cca4b144777
BLAKE2b-256 checksum
How to use checksums
eb80a1ac1aaaa2fb34f76bdabc31da91e95c22dfa03c732a01168549c06c807e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / cloelib-0.11.1-py3-none-any.whl

Download URL cloelib-0.11.1-py3-none-any.whl
Size 252.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27c8d0da4276b8efaa4d330459be2493511ad412cdf298347266df615c663c25
BLAKE2b-256 checksum
How to use checksums
4cf35e5eaa9750bc863387ce2179008c73054a7a2a711c491f68530af50478cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for cloelib 0.11.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cloelib-0.11.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page