Code for ANalysis of modified Distance-duality with cosmological Inference
Welcome to the CANDI code!
This repository provides a cosmological analysis code to place constraints from supernovae (SN), baryon acoustic oscillations (BAO), and gravitational waves (GW) through distance measurements.
It allows you to:
- Run likelihood analyses using current and simulated data.
- Implement custom cosmologies beyond ΛCDM, including models that break the distance–duality relation (DDR).
- Use different samplers (MCMC or nested sampling) to obtain posterior constraints.
Here you can find:
- 📈 Likelihoods for SN, BAO, and simulated Einstein Telescope (ET) standard sirens.
- 🧩 A custom cosmology API (Application Programming Interface) that lets you plug in your own models easily.
- 🔓 Tools to test DDR-breaking parametrizations.
- 🎲 Built-in support for Cobaya MCMC and Nautilus nested sampling.
- 📂 Ready-to-use example settings and demo notebooks to get you started quickly.
- Python ≥ 3.9
numpy,scipy,pandas,pyyamlcobaya,camb,getdist,nautilus
# Clone the repository
git clone https://github.com/chiaradeleo1/CANDI.git
cd CANDI
# Install dependencies
pip install -r requirements.txtThe data are not included in this repository.
To reproduce the results in of (arXiv:2505.13613), you can simulate datasets and run chains using the package in Zenodo (https://doi.org/10.5281/zenodo.17043955).
The package contains a notebook to generate simulated data for:
- 🟠 LSST Supernovae (SN)
- 🔵 SKAO Baryon Acoustic Oscillations (BAO)
- 🟣 Einstein Telescope (ET) Standard Sirens (GW)
The settings files to run the different scenarios discussed in the paper are provided in the settings/ folder and can be run using run_paper.py
Each run is controlled via a YAML settings file.
Key entries include:
output: name of the run / output folderSN_data,BAO_data,GW_data: specify which datasets to includecosmology: choose the expansion modelDDR_options: enable DDR-breaking modelssampler: choose betweenmcmcornautilus
Examples of YAML files can be found in the settings/ folder for different cosmological models, while interactive notebook examples are provided under the name DEMO_
You can implement your own cosmological model by following
theory_code/expansion_models/example_custom_cosmology.py.
A valid cosmology must provide at least:
H(z)— Hubble expansion ratecomoving(z)— comoving distance
With this interface you can:
- ✨ Implement your own DDR-breaking model (see e.g. arXiv:/2505.13613).
- 🌌 Modify the expansion history of the universe by introducing alternative cosmologies (see e.g. arXiv:2507.13890).
This makes it easy to go beyond ΛCDM and test custom scenarios with SN, BAO, and GW probes.
-
If you use this code, please cite our papers:
C. De Leo et. al , Distinguishing Distance Duality breaking models using electromagnetic and gravitational waves measurements, arXiv:2505.13613
E. Fazzari, C. De Leo et. al , Investigating f(R)-Inflation: background evolution and constraints, arXiv:2507.13890