Skip to main content

DISCO-CMB logo

DISCO-CMB

tests coverage lint types PyPI Downloads Python JAX arXiv Conventional Commits License: MIT

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for disco-cmb 0.2.0
File Size Uploaded Provenance Actions
disco_cmb-0.2.0.tar.gz 55.2 kB With provenance Details for disco_cmb-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for disco-cmb 0.2.0
File Interpreter ABI Platform Actions
disco_cmb-0.2.0-py3-none-any.whl Python 3 none any Details for disco_cmb-0.2.0-py3-none-any.whl

Total release size: 104.6 kB

Release files / disco_cmb-0.2.0.tar.gz

Download URL disco_cmb-0.2.0.tar.gz
Size 55.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7f9c2daad3e7afddd8413db3606175524d12d5f23e66164e3c6bf31bd1460576
BLAKE2b-256 checksum
How to use checksums
f6b55ffe83dc4ef3abc0ef4f35e2adf4168a3855112f3254b2b606b534236d85
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 log

Release files / disco_cmb-0.2.0-py3-none-any.whl

Download URL disco_cmb-0.2.0-py3-none-any.whl
Size 49.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d0410a8f76704ac22dd4bbfb9e09bef54a475c089a49e07c1b5ba7f42869e07
BLAKE2b-256 checksum
How to use checksums
d15b3679f5c9cff0b7388299c013f32da682f4bfa8615783ee820c3c844ae984
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 log

Security for disco-cmb 0.2.0

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.

Select from 2 files

Attestation for disco_cmb-0.2.0.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page