A compact research-grade pipeline for testing whether an oscillating dark-energy equation of state can compete with standard cosmological parameterizations when confronted with modern distance probes.
This repository implements an exploratory cosmological analysis combining:
- Pantheon+SH0ES Type Ia supernovae, using distance moduli and the full statistical + systematic covariance matrix;
- DESI DR2 BAO measurements, using DV/rd, DM/rd, and DH/rd
- Bayesian MCMC inference with
emcee; - Model comparison using χ², AIC and BIC;
- Convergence diagnostics based on acceptance fractions and integrated autocorrelation times.
The goal is to compare three models:
| Model | Description | Free parameters |
|---|---|---|
| ΛCDM | Standard flat cosmology with w = −1 | 2 |
| CPL | Dynamical dark energy with w(z) = w₀ + wₐ z/(1+z) | 4 |
| Ξosc | Phenomenological oscillating dark-energy equation of state | 6 |
The oscillating model is written as:
where ε controls the oscillation amplitude, T the characteristic period and φ₀ the phase.
Important
This project does not claim a discovery of oscillating dark energy.
It is an exploratory, reproducible test of whether a phenomenological oscillating equation of state remains competitive against standard dark-energy parameterizations.
The standard cosmological model, ΛCDM, assumes that the accelerated expansion of the Universe is driven by a cosmological constant with:
However, current and upcoming distance probes motivate careful tests of whether the dark-energy equation of state could evolve with cosmic time.
A common phenomenological extension is the Chevallier–Polarski–Linder (CPL) parameterization:
This project adds a third possibility:
which asks a simple question:
Could current supernova + BAO distance data accommodate a small oscillatory component in the dark-energy equation of state?
The analysis is intentionally modest and transparent: it does not try to establish a full physical theory, but rather tests a phenomenological signature against observational data.
The supernova component uses the Pantheon+SH0ES distance-modulus catalogue. The script reads:
zHDMU_SH0ESorMU_SHOESMU_SH0ES_ERR_DIAGorMU_SHOES_ERR_DIAG
and applies the redshift cut:
For the final run:
The full statistical + systematic covariance matrix is used.
The BAO component uses 13 DESI DR2 BAO measurements of the form:
- DV/rd
- DM/rd
- DH/rd
with a fixed fiducial sound horizon:
For the final combined analysis:
For each model, the pipeline:
- defines the expansion history E(z)=H(z)/H₀;
- computes cosmological distances in a flat universe;
- predicts supernova distance moduli (μ(z));
- predicts BAO observables DV/rd, DM/rd, and DH/rd;
- evaluates the combined Gaussian likelihood using covariance matrices;
- samples the posterior using MCMC;
- summarizes marginalized constraints;
- compares models using χ², AIC and BIC.
The model-comparison criteria are:
and
where k is the number of fitted parameters and N is the total number of data points.
The final long run used:
python src/xi_protocol1b_bao_run.py --nsteps 100000 --burn-in 20000 --nwalkers 96with:
| Quantity | Value |
|---|---|
| Supernovae retained | 1590 |
| BAO measurements | 13 |
| Total data points | 1603 |
| MCMC steps | 100000 |
| Burn-in | 20000 |
| Walkers | 96 |
| Samples retained for Ξosc | 7680000 |
| Model | χ² | k | AIC | BIC | ΔAIC |
|---|---|---|---|---|---|
| CPL | 1531.824 | 4 | 1539.824 | 1561.343 | 0.000 |
| Ξosc | 1529.763 | 6 | 1541.763 | 1574.041 | 1.939 |
| ΛCDM | 1554.165 | 2 | 1558.165 | 1568.924 | 18.341 |
Key interpretation:
- Ξosc gives the lowest raw χ².
- CPL remains slightly preferred by AIC.
- The difference between CPL and Ξosc is small:
- BIC is more severe and favors CPL because Ξosc has two additional parameters.
- ΛCDM is disfavored relative to the two dynamical models in this exploratory setup.
For the oscillating model, the final marginalized constraint is:
ε = 0.1847+0.0768−0.0867
Using a symmetrized uncertainty:
which gives:
This is an interesting non-zero preference, but it is not strong enough to claim a detection.
A conservative reading is:
The combined Pantheon+SH0ES + DESI DR2 BAO dataset allows an oscillatory dark-energy component and gives it the best raw χ², but the evidence is not decisive once model complexity is penalized.
Additional figures are available in:
figures/protocol1b_pantheon_desi/
figures/protocol1_pantheon_only/
figures/diagnostics/
xi-dark-energy-bao-mcmc/
│
├── README.md
├── LICENSE
├── CITATION.cff
├── requirements.txt
├── environment.yml
├── pyproject.toml
├── Makefile
│
├── src/
│ ├── xi_protocol1b_bao_run.py
│ ├── xi_protocol1_run.py
│ ├── 00_load_pantheon.py
│ └── xi_cosmo/
│ ├── results.py
│ ├── diagnostics.py
│ ├── labels.py
│ └── plotting.py
│
├── scripts/
│ ├── check_environment.py
│ ├── download_data.py
│ ├── export_final_tables.py
│ ├── make_chain_diagnostics.py
│ ├── organize_existing_outputs.py
│ ├── run_quick.ps1
│ └── run_final.ps1
│
├── data/
│ ├── README.md
│ └── raw/
│
├── figures/
│ ├── protocol1_pantheon_only/
│ ├── protocol1b_pantheon_desi/
│ └── diagnostics/
│
├── results/
│ └── protocol1b_pantheon_desi/
│ ├── final_model_comparison.csv
│ ├── final_parameter_estimates.csv
│ ├── final_model_comparison.md
│ └── chains/
│
├── notebooks/
│ ├── 00_project_overview.ipynb
│ ├── 01_data_inspection.ipynb
│ ├── 02_results_review.ipynb
│ └── 03_mcmc_diagnostics.ipynb
│
├── reports/
│ ├── Protocole1b_Pantheon_DESI_DR2_AlexBaker.pdf
│ └── latex/
│
├── docs/
│
└── tests/
git clone https://github.com/PhD-Brown/xi-dark-energy-bao-mcmc.git
cd xi-dark-energy-bao-mcmc
python -m venv .venvOn Windows PowerShell:
.\.venv\Scripts\Activate.ps1On macOS/Linux:
source .venv/bin/activateThen install:
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .conda env create -f environment.yml
conda activate xi-dark-energy
pip install -e .The raw data files are not committed by default.
Place the following files in:
data/raw/
Required files:
Pantheon+SH0ES.dat
Pantheon+SH0ES_STAT+SYS.cov
The DESI BAO files can be downloaded automatically:
python scripts/download_data.pyThis creates:
data/raw/desi_gaussian_bao_ALL_GCcomb_mean.txt
data/raw/desi_gaussian_bao_ALL_GCcomb_cov.txt
See data/README.md for details.
Use this to verify that the pipeline runs end-to-end without launching a long MCMC:
python src/xi_protocol1b_bao_run.py --quickOn Windows:
.\scripts\run_quick.ps1python src/xi_protocol1b_bao_run.py --nsteps 5000 --burn-in 1000 --nwalkers 64python src/xi_protocol1b_bao_run.py --nsteps 100000 --burn-in 20000 --nwalkers 96On Windows:
.\scripts\run_final.ps1The main runtime script writes outputs to:
results/
figures/
including:
results/summary_protocol1b_combined.txt
results/model_comparison_combined.csv
results/chains_<MODEL>_combined.npy
figures/corner_<MODEL>_combined.png
figures/w_of_z_combined.png
figures/bao_residuals_combined.png
Curated final outputs used for the report and public notebooks are organized under:
results/protocol1b_pantheon_desi/
figures/protocol1b_pantheon_desi/
Large MCMC chain files are intentionally ignored by Git:
results/**/chains/*.npy
They should be kept locally or distributed through a GitHub Release or external archive if needed.
The repository includes four lightweight notebooks:
| Notebook | Purpose |
|---|---|
00_project_overview.ipynb |
Public-facing overview of the final results |
01_data_inspection.ipynb |
Checks local data files and basic dimensions |
02_results_review.ipynb |
Reviews final tables and model-comparison results |
03_mcmc_diagnostics.ipynb |
Inspects saved MCMC chains if available locally |
The overview notebook does not rerun the full MCMC. It loads final summary tables and reproduces the key interpretation.
The final long run gave for Ξosc:
acceptance fraction ≈ 0.180
tau_max ≈ 1504
N/50 = 2000
Thus the practical criterion:
is satisfied for the final run.
However, some parameters remain weakly constrained, especially:
- T
- φ₀
This is expected for an exploratory oscillatory model with phase and period freedom.
Run the local checks with:
python scripts/check_environment.py
python scripts/export_final_tables.py
python scripts/make_chain_diagnostics.py
python -m pytest tests -q
python -m compileall src scriptsThe repository also includes a GitHub Actions workflow:
.github/workflows/python-check.yml
which installs the package and runs the test suite.
This project should be read as a methodological and exploratory analysis, not as a definitive cosmological claim.
Important caveats:
- ε ≈ 2.3σ is suggestive but not decisive.
- T and φ₀ remain weakly constrained.
- BIC favors CPL over Ξosc.
- The fixed rd choice should be varied in future work.
- Additional probes should be included before drawing strong physical conclusions.
- The Ξosc model is phenomenological and should eventually be connected to a more complete theoretical framework.
Possible extensions include:
- varying or marginalizing over rd;
- adding CMB priors;
- adding cosmic chronometers H(z);
- testing alternative BAO covariance treatments;
- comparing with more flexible dark-energy reconstructions;
- performing prior-sensitivity analyses on ε, T, and φ₀;
- using nested sampling for a stronger Bayesian evidence comparison;
- testing whether oscillatory behavior survives under alternative data combinations.
This repository is currently at the level of:
v0.1.0 — Initial exploratory Pantheon+SH0ES + DESI DR2 BAO analysis
It is suitable as:
- a reproducible research mini-project;
- a portfolio project in observational cosmology;
- a demonstration of Bayesian inference with real astrophysical data;
- a starting point for more robust dark-energy model comparison.
If you use or adapt this repository, please cite it using the metadata in:
CITATION.cff
A suggested citation format is:
Baker, A. (2026). Xi Dark Energy BAO MCMC: Exploratory Bayesian comparison of
ΛCDM, CPL and an oscillating dark-energy equation of state using Pantheon+SH0ES
and DESI DR2 BAO.
This project is released under the MIT License. See LICENSE.
This repository was developed as an exploratory cosmology analysis project using public distance-probe datasets and open-source scientific Python tools, including:
numpypandasscipymatplotlibastropyemceecorner
The analysis is intended as a transparent and reproducible starting point for further discussion, validation and extension.
Ξosc achieves the lowest raw χ², remains close to CPL according to AIC, and shows a non-zero oscillation amplitude at approximately 2.3σ.
However, CPL remains preferred by BIC, and the result should be interpreted as an exploratory indication rather than a detection.
Exploratory. Reproducible. Open to refinement.


