Skip to main content

jaxcapse

codecov arXiv Documentation Documentation Dev

Repo containing the jaxcapse emulator.

Documentation

Installation and usage

In order to install jaxcapse, you can just run

pip install jaxcapse

If you prefer to use the latest version from the repository, you can clone it, enter it, and run

pip install .

In order to use the emulators, you have to import jaxcapse and load a trained emulator

import jaxcapse
import jax.numpy as np
trained_emu = jaxcapse.load_emulator("/path/to/emu/")

Then you are good to! You have to create an input array and retrieve your calculation result

input_array = np.array([...]) #write in the relevant numbers
result = trained_emu.get_Cl(input_array)

# The returned grid always matches the prediction. Subsampled emulators with
# at most 2048 knots are transparently interpolated with a cubic spline.
ell = trained_emu.get_ell_grid()
ell_training = trained_emu.get_training_ell_grid()

For automatically interpolated grids, source bounds within 0.1 of an integer are snapped to that integer. Bounds farther away are moved inward.

CAMB Mnu-w0-wa-CDM emulators

The published CAMB + CosmoRec artifact contains TT, TE, EE, BB, and PP models. jaxcapse downloads them into a separate model-specific cache so they cannot be confused with the existing LCDM models:

import jax.numpy as jnp
import jaxcapse

params = jnp.array([3.044, 0.965, 0.054, 67.4, 0.02237, 0.120, 0.06, -1.0, 0.0])
tt = jaxcapse.trained_emulators["camb_mnuw0wacdm"]["TT"]
D_ell_TT = tt.get_Cl(params)
ell = tt.get_ell_grid()  # 2:9500

The input order is ln10As, ns, tau, H0, omega_b, omega_c, Mnu, w0, wa, restricted to w0 + wa < -0.5. Exact Mnu = 0 was not in the training set. Despite the method name, TT/TE/EE/BB outputs are lensed D_ell in microK^2; PP is [ell*(ell+1)]^2 C_ell^phiphi/(2*pi) (dimensionless).

For a more detailed explanation, check the tutorial in the notebooks folder, which also shows a comparison with the standard CAMB Boltzmann solver.

Citing

Free usage of the software in this repository is provided, given that you cite our release paper.

M. Bonici, F. Bianchini, J. Ruiz-Zapatero, Capse: efficient and auto-differentiable CMB power spectra emulation

Metadata

Release files for jaxcapse 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 jaxcapse 0.2.0
File Size Uploaded
jaxcapse-0.2.0.tar.gz 13.8 kB Details

Built distribution (wheel)

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

Total release size: 27.6 kB

Release files / jaxcapse-0.2.0.tar.gz

Download URL jaxcapse-0.2.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4dd2f506162acaf1b7ae3c9fed47a1a3a717e4cba6575b2e3a1a9ecc416a7dd7
BLAKE2b-256 checksum
How to use checksums
e3cc529c9f6eb7052d2436080b54b0962b40bd72c45d5573bae484d61b657896
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 28, 2026.

Transparency log

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

Download URL jaxcapse-0.2.0-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4d85b81872dcede1ab40228162d386f785099503daab2dd763f90c0ce594535
BLAKE2b-256 checksum
How to use checksums
b35cd7470b608581032c0e7f7b038e864183e3adbcb84910506f87c8a70ccb13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

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