nanoCMB: A minimal CMB power spectrum calculator in Python
Adam Moss

TL;DR
nanoCMB is a compact, accurate, and easy-to-understand Python tool for calculating CMB power spectra in flat ΛCDM cosmologies, suitable for educational and research purposes.
Contribution
It introduces a minimal, readable Python implementation of a full line-of-sight CMB power spectrum calculator with sub-percent accuracy.
Findings
Achieves sub-percent agreement with CAMB
Runs in about 10 seconds on a modern laptop
Provides a pedagogical, modifiable codebase
Abstract
We present nanoCMB, a minimal but accurate calculator for the unlensed CMB temperature and polarisation angular power spectra (, , ) of flat CDM cosmologies. Written in 1400 lines of readable Python, the code implements the full line-of-sight integration method: RECFAST recombination, coupled Einstein--Boltzmann perturbation equations in synchronous gauge with a tight-coupling approximation, precomputed spherical Bessel function tables, and optimally constructed non-uniform grids in wavenumber and conformal time. Despite its brevity, nanoCMB achieves sub-percent agreement with CAMB across the multipole range , running in 10 seconds on a modern laptop. The entire calculation lives in a single, easily modifiable Python script, designed as a pedagogical bridge between textbook treatments and research-level…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsCosmology and Gravitation Theories · Galaxies: Formation, Evolution, Phenomena · Computational Physics and Python Applications
