JAX implementation of AbstractCosmologicalEmulators.jl interface with artifact support
Project description
jaxace
JAX/Flax implementation of cosmological emulators with automatic JIT compilation.
Installation
pip install -e .
Usage
import jaxace
import jax.numpy as jnp
import numpy as np
# Cosmology
cosmo = jaxace.w0waCDMCosmology(
ln10As=3.044, ns=0.9649, h=0.6736,
omega_b=0.02237, omega_c=0.1200,
m_nu=0.06, w0=-1.0, wa=0.0
)
# Background functions
z = jnp.array([0.0, 0.5, 1.0])
growth = cosmo.D_z(z)
distance = cosmo.r_z(z)
# Neural network emulator
emulator = jaxace.init_emulator(nn_dict, weights, jaxace.FlaxEmulator)
output = emulator(input_data) # Auto-JIT + batch detection
Included trained generic emulators
jaxace ships artifact definitions for the official 300303 trained
GenericEmulator pair:
ACE_mnuw0wacdm_sigma8_basisACE_mnuw0wacdm_ln10As_basis
They can be loaded directly from the package artifact registry. The first call downloads and caches the emulator; later calls reuse the local cache.
import jaxace
import numpy as np
# Input order for the sigma8-basis emulator:
# z, sigma8, ns, H0, ombh2, omch2, Mnu, w0, wa
emu = jaxace.get_emulator("ACE_mnuw0wacdm_sigma8_basis")
params = np.array([0.5, 0.8, 0.96, 67.0, 0.022, 0.12, 0.06, -1.0, 0.0])
output = emu.run_emulator(params)
# The ln10As-basis emulator uses ln10As in the second slot instead of sigma8:
emu_ln10As = jaxace.get_emulator("ACE_mnuw0wacdm_ln10As_basis")
params_ln10As = np.array([0.5, 3.044, 0.96, 67.0, 0.022, 0.12, 0.06, -1.0, 0.0])
output_ln10As = emu_ln10As.run_emulator(params_ln10As)
Available artifact-backed emulators can be listed with:
jaxace.list_emulators()
Postprocessing API
jaxace 0.6.0 matches the current AbstractCosmologicalEmulators.jl generic
emulator API. Custom postprocessing functions should take three arguments:
def postprocessing(input_params, output, emulator):
return output
When loading an emulator from disk, postprocessing.py should define that
function. Legacy four-argument functions
postprocessing(input_params, output, auxiliary_params, emulator) are still
accepted for backward compatibility, but new emulators should use the
three-argument form.
Features
- Background cosmology (growth, distances, Hubble)
- Neural network emulators with auto-JIT
- Massive neutrinos and dark energy support
- Full JAX integration (grad, vmap, jit)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jaxace-0.6.0.tar.gz.
File metadata
- Download URL: jaxace-0.6.0.tar.gz
- Upload date:
- Size: 32.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb162380c31563ae88a97b15127c835b73b74c686ee5f03ecf7f7a1757d2a38c
|
|
| MD5 |
10083207730d225d2353380bbe6ba826
|
|
| BLAKE2b-256 |
728b12ca744b0b39ef1bb86839e627604cca5b5ec49aeda2b70c9b977adce5d1
|
Provenance
The following attestation bundles were made for jaxace-0.6.0.tar.gz:
Publisher:
publish.yml on CosmologicalEmulators/jaxace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jaxace-0.6.0.tar.gz -
Subject digest:
bb162380c31563ae88a97b15127c835b73b74c686ee5f03ecf7f7a1757d2a38c - Sigstore transparency entry: 1741463404
- Sigstore integration time:
-
Permalink:
CosmologicalEmulators/jaxace@d2519c520cea16241c56af5bbe66b5bc5194dabe -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/CosmologicalEmulators
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d2519c520cea16241c56af5bbe66b5bc5194dabe -
Trigger Event:
release
-
Statement type:
File details
Details for the file jaxace-0.6.0-py3-none-any.whl.
File metadata
- Download URL: jaxace-0.6.0-py3-none-any.whl
- Upload date:
- Size: 35.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
879591ce5d983a2363c4f83dfa671e352176dfed38a32766cb9d7169202ff2fd
|
|
| MD5 |
02489e4b0e1a8611ea153ac5b48325cd
|
|
| BLAKE2b-256 |
bb8ab07c66774bca3fc72cca016dfe701e89191c736d6a4189c19e67210b3447
|
Provenance
The following attestation bundles were made for jaxace-0.6.0-py3-none-any.whl:
Publisher:
publish.yml on CosmologicalEmulators/jaxace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jaxace-0.6.0-py3-none-any.whl -
Subject digest:
879591ce5d983a2363c4f83dfa671e352176dfed38a32766cb9d7169202ff2fd - Sigstore transparency entry: 1741463418
- Sigstore integration time:
-
Permalink:
CosmologicalEmulators/jaxace@d2519c520cea16241c56af5bbe66b5bc5194dabe -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/CosmologicalEmulators
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d2519c520cea16241c56af5bbe66b5bc5194dabe -
Trigger Event:
release
-
Statement type: