cosmograd
Differentiable cosmology in JAX, with interchangeable background and perturbation models.
Installation
uv add cosmograd
uv add 'cosmograd[cosmopower]' # CosmoPower-JAX backend
uv add 'cosmograd[bacco]' # bacco emulator backend
Usage
import jax
from cosmograd import EisensteinHu, FlatLCDM
cosmo = FlatLCDM(H0=67.36, omega_m=0.3153)
cosmo.luminosity_distance(1.0) # Mpc
jax.grad(lambda c: c.comoving_distance(1.0))(cosmo)
EisensteinHu(cosmo).matter_power_spectrum(0.1, 0.5) # Mpc^3
See the API docstrings for parameter conventions, units and valid ranges.
Features
- Background expansion and distances for curved and flat cosmologies.
- Linear growth and Eisenstein–Hu matter power spectra.
- Optional CosmoPower and bacco emulator backends.
- JAX differentiation through cosmological parameters.
Caveats
Perturbation backends assume a flat universe. Set the cosmological parameters explicitly when computing spectra; otherwise their defaults are used. The growth solver's initial conditions require matter domination; see its docstring for radiation and redshift constraints. Emulator weights may download on first use.
References
- CosmoPower-JAX: Piras & Spurio Mancini (2023), CosmoPower paper, and repository.
- baccoemu: linear power emulator, nonlinear power emulator, and repository.
- Eisenstein & Hu (1998), Baryonic Features in the Matter Transfer Function
- Smith & Angulo (2019), Precision modelling of the matter power spectrum
- Planck Collaboration (2020), Planck 2018 cosmological parameters
License
Metadata
Release files for cosmograd 0.1.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 |
|---|---|---|---|---|
| cosmograd-0.1.1.tar.gz | 32.5 kB | With provenance | Details for cosmograd-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cosmograd-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for cosmograd-0.1.1-py3-none-any.whl |
Total release size: 78.0 kB
Release files / cosmograd-0.1.1.tar.gz
| Download URL | cosmograd-0.1.1.tar.gz |
|---|---|
| Size | 32.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffc8123b5f18920a9c7ac57190ecd015a26f035c81b28bbbcbc314f8daa9e028
|
|
BLAKE2b-256 checksum How to use checksums |
40397d8ff051b3f6b401fcbdb0ba438cb11e4c6cb52aaa72ee2dee889d955ce4
|
| 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 15, 2026.
Transparency logRelease files / cosmograd-0.1.1-py3-none-any.whl
| Download URL | cosmograd-0.1.1-py3-none-any.whl |
|---|---|
| Size | 45.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
494304555a9040e0c22c9c22622db8a8f155aa088db78b13f4531d752966067b
|
|
BLAKE2b-256 checksum How to use checksums |
b19e2cdcdfc7d75aa0e320cd9d1e2b9621d154a5252059ac5c904ffec416125d
|
| 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 15, 2026.
Transparency logSecurity for cosmograd 0.1.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 cosmograd-0.1.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 15, 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.