Skip to main content

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 brings DISCO-EB with it:

pip install "disco-cmb[cuda13]"   # or [cuda12], which Python 3.10 needs

Quickstart

This example computes the unlensed spectra of three cosmologies that differ in their spectral index. The grids come from a fiducial cosmology once, and every later batch reuses them:

from discocmb import cmb_grids, compute_cl_power_spectrum_batch

planck = {
    "Omegam": 0.3144,
    "Omegab": 0.04939,
    "H0": 67.32,
    "Omegak": 0.0,
    "A_s": 2.1e-9,
    "n_s": 0.966,
    "k_p": 0.05,
    "Tcmb": 2.7255,
    "YHe": 0.2454,
    "Neff": 3.046,
    "Nmnu": 0.0,
    "mnu": 0.0,
    "w_DE_0": -1.0,
    "w_DE_a": 0.0,
    "cs2_DE": 1.0,
}
batch = [planck | {"n_s": n_s} for n_s in (0.95, 0.966, 0.98)]

grids = cmb_grids(planck)
ells, cl, dl = compute_cl_power_spectrum_batch(batch, grids=grids)
dl.tt  # (3, n_ell) in muK^2

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.1.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.1.0
File Size Uploaded Provenance Actions
disco_cmb-0.1.0.tar.gz 44.7 kB With provenance Details for disco_cmb-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 79.0 kB

Release files / disco_cmb-0.1.0.tar.gz

Download URL disco_cmb-0.1.0.tar.gz
Size 44.7 kB
Tags Source
SHA-256 checksum
How to use checksums
db4a40bdd0cb21a870027d40320a2dc7c8a8bb714bbbb9485788fc362317583f
BLAKE2b-256 checksum
How to use checksums
9b5b187675f52daad301db4be94fae509bad11487b0cfebb6e856fa7a6c3f2df
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 11, 2026.

Transparency log

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

Download URL disco_cmb-0.1.0-py3-none-any.whl
Size 34.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b94bc66f3d847a21cb4bf530fe6d063d5fb80da93e852887e069b719f7910032
BLAKE2b-256 checksum
How to use checksums
b9a8a9ebda1bd5f962c7b3ae80f9d78b121f7f658dcb0f284739c6da9d74fef5
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 11, 2026.

Transparency log

Security for disco-cmb 0.1.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.1.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 11, 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