DISCO-CMB
Installation • Quickstart • Documentation • DISCO-EB paper • Citation
DISCO-CMB computes CMB angular power spectra for batches of cosmologies on the GPU. It builds on the Einstein-Boltzmann solver of DISCO-EB and adds line-of-sight integration, the unlensed TT, TE and EE spectra, the lensing potential and the lensed TT, TE, EE and BB spectra.
A single GPU launch evolves every wave mode of every cosmology in a batch, with the line-of-sight sources evaluated inside the solver's kernel. The unlensed TT spectrum agrees with CLASS to 0.25 percent for multipoles 2 to 1200, and JAX can differentiate the spectra with respect to the cosmological parameters.
The documentation covers the API and explains how the pipeline fits together.
Installation
DISCO-CMB needs an NVIDIA GPU. Install it from PyPI, which also installs DISCO-EB:
pip install "disco-cmb[cuda13]" # or [cuda12], which Python 3.10 needs
Quickstart
This example computes the spectra of three flat LCDM cosmologies that differ in their spectral index. A cosmology is an instance of a DISCO-EB model, and a batch of cosmologies is a list of such instances. Grid holds the wave modes, save times and multipoles, shaped by a fiducial cosmology, with the tables the projection needs. solve_cmb computes the unlensed spectra of a batch on it:
from discoeb import LCDM
from discocmb import Grid, solve_cmb
planck = LCDM.from_density_parameters(
Omega_m=0.3144,
Omega_b=0.04939,
H_0=67.32,
A_s=2.1e-9,
n_s=0.966,
T_cmb=2.7255,
Y_He=0.2454,
N_eff=3.046,
)
batch = [planck.replace(n_s=n_s) for n_s in (0.95, 0.966, 0.98)]
grid = Grid.from_fiducial(planck)
ells, cl, dl = solve_cmb(batch, grid=grid)
dl.tt # (3, 3401) in muK^2, from l = 0
Development
The repository uses uv:
git clone https://github.com/cosmo-sims/DISCO-CMB.git
cd DISCO-CMB && uv sync --extra cuda13 # or --extra cuda12
uv run pytest tests # needs a CUDA GPU
uv run ruff format && uv run ruff check --fix
uv run ty check
uv run pre-commit install # the checks above, and a commit-message check
The documentation (Sphinx with MyST and autodoc) builds in an environment of its own, the package plus the docs group:
export UV_PROJECT_ENVIRONMENT=.venv-docs
uv sync --no-default-groups --group docs
uv run --no-sync sphinx-autobuild docs docs/_build/html # live preview
uv run --no-sync sphinx-build -W docs docs/_build/html # what CI runs
Citation
If you use DISCO-CMB in your research, please cite this repository (see CITATION.cff) and the DISCO-EB article it builds on:
@article{DISCO-EB:2024,
author = "Hahn, Oliver and List, Florian and Porqueres, Natalia",
title = "{DISCO-DJ I: a differentiable Einstein-Boltzmann solver for cosmology}",
eprint = "2311.03291",
archivePrefix = "arXiv",
primaryClass = "astro-ph.CO",
doi = "10.1088/1475-7516/2024/06/063",
journal = "JCAP",
volume = "06",
pages = "063",
year = "2024"
}
License
DISCO-CMB is released under the MIT License.
Metadata
Release files for disco-cmb 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| disco_cmb-0.2.1.tar.gz | 56.5 kB | With provenance | Details for disco_cmb-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| disco_cmb-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for disco_cmb-0.2.1-py3-none-any.whl |
Total release size: 107.2 kB
Release files / disco_cmb-0.2.1.tar.gz
| Download URL | disco_cmb-0.2.1.tar.gz |
|---|---|
| Size | 56.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58169bd2b86266c4872d5526478711085a890ea0e905b61e484d30cf064029f2
|
|
BLAKE2b-256 checksum How to use checksums |
24ec75aed9180bbd0d9fe82f158f53377c8d603821773efc94e4cbf9db46aba5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / disco_cmb-0.2.1-py3-none-any.whl
| Download URL | disco_cmb-0.2.1-py3-none-any.whl |
|---|---|
| Size | 50.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3de916dd2adc05fa46853f30cb42f16d690b47647a220213fabd3f33e9b773e
|
|
BLAKE2b-256 checksum How to use checksums |
513aca425c3c2bd777cf90571da10344f73b24bc825580794d427b9fbf55d18b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for disco-cmb 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for disco_cmb-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.