Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

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. Statistics Tutorials (tutorials/statistics/)

  • Measuring the Hubble Constant (H₀) with Type Ia Supernovae – Bayesian inference, MCMC, and parameter estimation using SNe Ia data.
  • Measuring H₀ with Cobaya – Same analysis recast using Cobaya as the MCMC sampler.

2. Software Tutorials (tutorials/software/)

Cobaya (tutorials/software/Cobaya/)

  • Tutorial 1 – Introduction to Cobaya: sampling multivariate Gaussian and Ring likelihoods.
  • Tutorial 2 – Advanced Cobaya: running cosmology chains and using the get_model() wrapper to access internal calculations.

Theory Codes (tutorials/software/TheoryCodes/)

  • CAMB & CosmoPower – Hands-on tutorial computing power spectra with CAMB and CosmoPower emulator, including a cloelib example.

3. Exercises (exercises/)

  • H₀ Statistics Exercises – Practice problems on basic cosmological statistics using SNe Ia and H₀.
  • CAMB & CosmoPower Exercises – Exercises on computing and manipulating power spectra (+ cloelib).

4. Examples (tutorials/examples/)

  • Python for Astronomy – Python basics and tools relevant to astronomy and cosmology.

🚀 Getting Started

Clone the Repository

git clone https://github.com/gcanasherrera/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)
  • camb – CMB power spectrum code (for TheoryCodes tutorials)
  • cosmopower – neural network emulator for power spectra (for TheoryCodes tutorials)
  • cloelib – Euclid Consortium's theory-prediction library (for TheoryCodes 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

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages