Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ jobs:
run: python scripts/make_figures.py
env:
MPLBACKEND: Agg
- name: Run validation against CAMB
run: python scripts/validate.py
env:
MPLBACKEND: Agg
- name: Check committed results tables match the code
if: matrix.python-version == '3.13'
run: git diff --exit-code -- results/key_results.md results/validation.md
- name: Execute notebook top to bottom
run: jupyter nbconvert --to notebook --execute --output /tmp/executed.ipynb notebooks/recombination_and_decoupling.ipynb

Expand All @@ -54,3 +61,7 @@ jobs:
run: python scripts/make_figures.py
env:
MPLBACKEND: Agg
- name: Run validation against CAMB
run: python scripts/validate.py
env:
MPLBACKEND: Agg
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ authors:
website: "https://sethuastro.github.io/"
repository-code: "https://github.com/sethuastro/CMB_Decoupling"
license: MIT
version: 0.1.0
date-released: 2026-10-22
version: 1.0.0
date-released: 2026-11-02
keywords:
- cosmology
- cosmic microwave background
Expand Down
378 changes: 267 additions & 111 deletions README.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion archive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ Known issues, fixed in the package:
- cosmological parameters and constants were duplicated across files without
sources.

Using the Saha x_e, the visibility function peaks at z ≈ 1277, much earlier
Using the Saha x_e, the visibility function peaks at z = 1283.6 (`python scripts/validate.py`), much earlier
than the z ≈ 1080 obtained once the Peebles model is used. This is the
physical failure of Saha equilibrium at late times, not a coding error; see
`docs/theory.md`.

An earlier version of this note gave z ≈ 1277; that figure came from the archive scripts above
(before the fixes listed), not from the package.
Binary file added figures/validation.pdf
Binary file not shown.
Binary file added figures/validation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "cmb-decoupling"
version = "0.1.0"
version = "1.0.0"
description = "Hydrogen recombination (Saha, Peebles) and CMB photon decoupling, validated against CAMB/RECFAST"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
97 changes: 97 additions & 0 deletions results/validation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"camb_version": "2.0.5",
"camb_recombination": "Recfast",
"last_scattering": {
"camb": {
"z_star": 1089.8900710994267,
"z_peak": 1078.3679452200388,
"fwhm": 204.00059486771897
},
"peebles": {
"z_star": 1089.4370745392039,
"z_peak": 1078.7955467016986,
"fwhm": 203.33067774818244
},
"peebles_fudge": {
"z_star": 1090.2769961061613,
"z_peak": 1079.0473446893725,
"fwhm": 202.72657409606586
}
},
"camb_recfast_settings": {
"fudge": 1.125,
"Hswitch": true,
"gauss_centres_z": [
1451.884439702605,
867.4446628700608
]
},
"residuals_vs_camb": {
"peebles": {
"window_lo": 966.507145886229,
"window_hi": 1170.507740753948,
"max_abs_window": 0.010813545422290627,
"z_max_abs_window": 1170.5,
"min_residual": -0.03579640434004827,
"z_min_residual": 2000.0,
"max_residual": 0.1404936065241551,
"z_max_residual": 200.0,
"z_min": 200.0,
"z_max": 2000.0,
"residual_at_freeze_out": 0.1404936065607214
},
"peebles_fudge": {
"window_lo": 966.507145886229,
"window_hi": 1170.507740753948,
"max_abs_window": 0.010390256944198484,
"z_max_abs_window": 1170.5,
"min_residual": -0.03579640434004827,
"z_min_residual": 2000.0,
"max_residual": 0.014606252660196661,
"z_max_residual": 1264.0,
"z_min": 200.0,
"z_max": 2000.0,
"residual_at_freeze_out": 0.008650244424860842
}
},
"residuals_hydrogen_era": {
"peebles": {
"window_lo": 966.507145886229,
"window_hi": 1170.507740753948,
"max_abs_window": 0.01081268868056795,
"z_max_abs_window": 1170.488888888889,
"min_residual": -0.003268465909092355,
"z_min_residual": 1800.0,
"max_residual": 0.14049360653415421,
"z_max_residual": 200.0,
"z_min": 200.0,
"z_max": 1800.0
},
"peebles_fudge": {
"window_lo": 966.507145886229,
"window_hi": 1170.507740753948,
"max_abs_window": 0.010389339233394024,
"z_max_abs_window": 1170.488888888889,
"min_residual": -0.014599229913939693,
"z_min_residual": 861.5111111111112,
"max_residual": 0.014606253069484154,
"z_max_residual": 1264.0,
"z_min": 200.0,
"z_max": 1800.0
}
},
"residuals_helium_era": {
"z_min": 1800.0,
"z_max": 3000.0,
"min_residual": -0.05810588572572306,
"z_min_residual": 2299.4
},
"tau_integrator_check": {
"z_star_from_camb_xe": 1089.8900710994267,
"z_star_camb_internal": 1089.8922558485872
},
"saha": {
"z_star": 1291.1323350280427,
"z_peak": 1283.606148602622
}
}
23 changes: 23 additions & 0 deletions results/validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
| | Peebles (this work) | Peebles, F = 1.14 (this work) | CAMB 2.0.5 (RECFAST) |
|---|---|---|---|
| $z_\ast$ where $\tau = 1$ | 1089.44 | 1090.28 | 1089.89 |
| Peak of $g(z)$ per unit $z$ | 1078.80 | 1079.05 | 1078.37 |
| FWHM of $g(z)$ | 203.33 | 202.73 | 204.00 |

Residuals $\Delta x_e/x_e = x_e/x_e^{\rm CAMB} - 1$ on $z = 200$–$2000$ (grid spacing $\Delta z = 0.1$). Last-scattering window = FWHM of CAMB's $g(z)$, $z = 966.5$–$1170.5$.

| | Peebles (this work) | Peebles, F = 1.14 (this work) |
|---|---|---|
| (a) max $\lvert\Delta x_e/x_e\rvert$ in the last-scattering window | 1.08% at $z = 1170.5$ | 1.04% at $z = 1170.5$ |
| (b) most negative residual | -3.58% at $z = 2000.0$ | -3.58% at $z = 2000.0$ |
| (c) most positive residual | +14.05% at $z = 200.0$ | +1.46% at $z = 1264.0$ |
| residual at $z = 200$ | +14.05% | +0.87% |
| range on $z = 200$–$1800$ (hydrogen only) | -0.33% to +14.05% | -1.46% to +1.46% |

Helium era, $z = 1800$–$3000$: most negative residual -5.81% at $z = 2299.4$ (both models; helium is in Saha).

$\tau$-integrator check: CAMB's $x_e$ through this code gives $z_\ast = 1089.8901$; CAMB's internal value is 1089.8923 (difference -0.0022).

CAMB RECFAST settings: $F = 1.125$, Hswitch = True (Gaussian corrections centred at $z \approx 1452$ and 867).

Saha (H + He) for comparison: $z_\ast = 1291.13$, peak of $g(z)$ at 1283.61.
Loading
Loading