Skip to content

Collection of Jupyter notebooks demonstrating statistical methods for cosmological data analysis, including Bayesian inference & basic frequentist tools

License

Notifications You must be signed in to change notification settings

gcanasherrera/Stats4Cosmology

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Stats4Cosmology

DOI

A curated collection of Jupyter notebooks introducing and applying statistical methods and cosmological inference tools to problems in cosmology.

This repository combines:

  • Practical statistical tutorials for students and researchers.
  • Step-by-step Cobaya tutorials for Bayesian cosmological parameter estimation and model comparison, now included as a subfolder of the main tutorials.

✨ Contents

1. Stats4Cosmology Notebooks (tutorials/statistics)

  • Probability & Statistics Refresher – Basics of probability distributions, likelihoods, and Bayes’ theorem.
  • Bayesian Inference in Cosmology – MCMC, nested sampling, and posterior exploration with toy cosmological models.
  • Fisher Forecasting – Deriving Fisher matrices and forecasting cosmological parameter constraints.
  • Likelihoods for Cosmology – Building Gaussian and non-Gaussian likelihoods connected to cosmological data vectors.
  • Applications – Toy SN & LSS parameter estimation, combining multiple probes, impact of priors and degeneracies.

2. Software Tutorials (tutorials/software/)

  • Cobaya – Sampling multi-variate Gaussian and Ring likelihoods; running simple cosmology chains & using the get_model() wrapper in Cobaya to access all internal calculations without modifying the source code.

🚀 Getting Started

Clone the Repository

git clone https://github.com/your-username/Stats4Cosmology.git
cd Stats4Cosmology

Launch Jupyter, or Cloud servers

jupyter lab

Open any notebook under the tutorials/ folder to explore Stats4Cosmology, or navigate to tutorials/software/ for software specific exercises.

You can run Cobaya notebooks on Google Colab. For Cobaya specific notebooks you will need:

!pip install cobaya
!cobaya-install cosmo -p .

📚 Dependencies

The notebooks rely on standard scientific Python libraries widely used in astronomy and cosmology:

  • numpy – numerical computing
  • scipy – scientific routines
  • astropy – astronomy & cosmology utilities
  • matplotlib – plotting
  • seaborn – statistical visualization
  • jupyter – interactive notebooks
  • cobaya – cosmological Bayesian analysis (for Cobaya tutorials)

🧑‍🏫 Who Is This For?

  • Students in astrophysics, physics, or statistics wanting hands-on cosmological inference training.
  • Researchers looking for ready-to-use templates for teaching, lectures, or experimentation.
  • Educators needing practical examples for cosmology and data science courses.
  • Anyone interested in learning how to use Cobaya for Bayesian cosmological analysis.

👩‍🚀 Author

Developed and maintained by Dr. Guadalupe Cañas-Herrera, inspired by real-world cosmological pipelines in the era of Euclid, probably biased by Planck 18 analysis experience.


📄 License

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


⭐ Citation

If you find these notebooks useful in your research or teaching, please cite:

@misc{stats4cosmology,
  author       = {Cañas Herrera, Guadalupe},
  title        = {Stats4Cosmology: Jupyter notebooks for statistical methods in cosmology, including Cobaya tutorials},
  year         = {2025},
  howpublished = {\url{https://github.com/gcanasherrera/Stats4Cosmology}}
}

About

Collection of Jupyter notebooks demonstrating statistical methods for cosmological data analysis, including Bayesian inference & basic frequentist tools

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published