Skip to content

Repository files navigation

cosmicfishpie

All Contributors

Documentation Status codecov 37.50 % FAIR CI Code style: black Ask DeepWiki

cosmicfishpie is a Python package for cosmological Fisher forecasts. It is designed to help prepare and compare forecasts for surveys such as Euclid, DESI, SKAO, and CMB experiments, using flexible pipelines that combine cosmology backends, survey specs, and post-processing tools.

What you can do with cosmicfishpie

  • Compute Fisher matrices for multiple observables (e.g. spectroscopic/photometric galaxy probes and CMB spectra).
  • Use established Einstein-Boltzmann solvers such as CAMB (and configurable backend workflows).
  • Choose finite-difference strategies and numerical settings for derivatives and stability.
  • Run likelihood-based Bayesian sampling with Nautilus (nested sampling / MCMC-style posterior analysis).
  • Combine, reparameterize, and post-process Fisher matrices after the initial run.
  • Generate publication-ready comparison and corner plots.

Installation

cosmicfishpie supports Python >=3.10,<3.13.

Recommended: uv workflow

Create a virtual environment and install from source:

git clone https://github.com/santiagocasas/cosmicfishpie.git
cd cosmicfishpie
uv venv --python 3.11
source .venv/bin/activate
uv sync --extra dev

For a lighter install (without the dev extras):

uv sync

Alternative: mamba/conda-forge workflow

If you prefer Conda-style environments, create one with mamba (or conda) and install from source in editable mode:

mamba create -n cosmicfishpie -c conda-forge python=3.11 pip
mamba activate cosmicfishpie
git clone https://github.com/santiagocasas/cosmicfishpie.git
cd cosmicfishpie
pip install -e .

This setup lets you manage the environment with conda-forge while using the latest repository version.

Quick check

After installation, run:

python -c "import cosmicfishpie; print('cosmicfishpie import OK')"

If you installed from source (dev setup), you can also run tests:

uv run pytest

Minimal usage example

import cosmicfishpie.fishermatrix.cosmicfish as cff

options = {
    "accuracy": 1,
    "feedback": 2,
    "outroot": "example_run",
    "results_dir": "results/",
    "derivatives": "3PT",
    "nonlinear": True,
    "cosmo_model": "LCDM",
    "code": "camb",
    "survey_name": "Euclid",
    "survey_name_spectro": "Euclid-Spectroscopic-ISTF-Pessimistic",
}

observables = ["GCsp"]
fiducial = {"Omegam": 0.32, "h": 0.67}
freepars = {"Omegam": 0.01, "h": 0.01}

fm = cff.FisherMatrix(
    fiducialpars=fiducial,
    freepars=freepars,
    options=options,
    observables=observables,
    cosmoModel=options["cosmo_model"],
    surveyName=options["survey_name"],
)

fisher_matrix = fm.compute()

For fuller examples and configuration details, see the documentation.

Documentation and citation

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Sefa Pamuk
Sefa Pamuk

💻 🎨 🤔 ⚠️ 🔬 👀 📓 💡 📖 🖋 🐛
Santiago Casas
Santiago Casas

🐛 🖋 🔣 📖 💡 🤔 🚧 📆 🔬 👀 ⚠️ 📓
Matteo Martinelli
Matteo Martinelli

💻 🎨 🤔

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

About

CosmicFishPie: Python Fisher Matrix code for Cosmological probes

Topics

Resources

Contributing

Stars

5 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages