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!
- β¨ Features
- π Supported external codes
- π Installation
- π Usage
- π€ Contributing
- π License
- π Acknowledgements
πΉ 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
Protocolsfollowing 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.
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 |
| NA | HMCode2020emu | NA |
| NA | cosmopower-jax | NA |
| NA | euclidemu2 | NA |
| NA | BACCOemu | NA |
| NA | e-MANTIS | NA |
Several optional dependencies enhance cloelib capabilities:
pyinstrumentβ Time profiling for performance optimizationpylevin,mpmathβ Required for specific observational probes (i.e: COSEBIs)tensorflowβ Needed for certain emulator backends (i.e:HMCode2020emu)
These are not included in the default installation but can be installed as shown below.
Quick Start π―
- Set up your environment β Create a fresh conda/mamba environment using the cloe-org-environments repository. Then, 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"- Install cloelib β Get the core library up and running:
pip install .- Add optional superpowers β Enhance with external dependencies and tools:
pip install .[camb,classy,hmcode2020emu,comet-emu,euclidemu2,pylevin,mpmath,tensorflow,pyinstrument,baccoemu,emantis,pbjcosmo,react]π‘ Pro Tip: Some shells struggle with brackets. Try quotes if needed:
pip install ."[camb,classy,hmcode2020emu,comet-emu,euclidemu2,pylevin,mpmath,tensorflow,pyinstrument,baccoemu,emantis,pbjcosmo,react]"
The react extra installs MGEmu together with the TensorFlow support it needs for the ReACT modified-gravity boost module. If you only need that stack, pip install ".[react,camb]" is usually enough to get started.
You're all set! π Ready to compute cosmological observables.
Explore the tutorials in the cloe-org/playground repository for examples on how to compute cosmological observables and other key quantities!
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-name2οΈβ£ 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-name5οΈβ£ Open a pull request and contribute to the project!
This project is licensed under the MIT LICENSE β see the LICENSE file for details.
π 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.
This project follows the all-contributors specification. Contributions of any kind are welcome!