Skip to main content

CI Docs PyPI Python License: MIT DOI

reionemu logo

reionemu

Machine-learning emulators for the kinetic Sunyaev-Zel'dovich (kSZ) angular power spectrum from reionization simulations, with uncertainty quantification.

The kSZ effect arises when CMB photons scatter off free electrons with bulk motion, and its angular power spectrum carries information about the timing, duration, and structure of reionization. reionemu learns the mapping of reionization parameters to binned kSZ power spectra, so parameter space can be explored without rerunning expensive simulations.

Installation

pip install reionemu

Requires Python 3.10+. Installs NumPy, h5py, PyTorch, and Ray Tune.

Quick start

Train the MC-dropout emulator on a condensed HDF5 dataset, then predict with uncertainties:

from pathlib import Path

import numpy as np
import torch

import reionemu

# An HDF5 file that already contains /training (X, Y, ell)
h5_path = Path("condensed.h5")

loaders, normalizers, ell = reionemu.make_dataloaders(
    h5_path,
    split={"train": 0.8, "val": 0.2},
    config=reionemu.DataLoaderConfig(batch_size=32, seed=42),
)

model = reionemu.MCDropoutEmulator(dropout_rate=0.1)
history = reionemu.fit(
    model,
    loaders["train"],
    loaders["val"],
    torch.optim.Adam(model.parameters(), lr=1e-3),
    torch.nn.MSELoss(),
    config=reionemu.FitConfig(epochs=10, device="cpu"),
)

# (zmean_zre, alpha_zre, kb_zre, b0_zre)
theta = np.array([[8.0, 0.5, 1.0, 0.45]], dtype=np.float32)

pred_mean, pred_std, _, _ = reionemu.predict_mc(
    theta,
    model,
    X_mean=normalizers["X"].mean,
    X_std=normalizers["X"].std,
    n_mc_samples=200,
)

print(pred_mean, pred_std)

What's included

Module Covers
simio Condense simulation outputs, compute flat-sky power spectra, build training arrays
data Dataloaders, train/validation splits, normalization
models Deterministic and MC-dropout emulator architectures
training Training loop, K-fold cross-validation, metrics, model builders
tuning Ray Tune hyperparameter search
artifact JSON experiment manifests, normalizers, checkpoints

Everything stable is re-exported at the top level. Experimental variants live under reionemu.models.experimental.

Documentation

Full API reference, guides, and a worked pipeline example: reionemu.org/reionemu

Citation

If reionemu contributes to work you publish, please cite both the software and the relevant paper.

Software

This entry uses the concept DOI, which always resolves to the latest release.

@software{pearce_reionemu,
  author    = {Pearce, Robert},
  title     = {{reionemu: Python package for emulating the kSZ angular power spectrum from reionization simulations}},
  year      = {2026},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.21766410},
  url       = {https://doi.org/10.5281/zenodo.21766410},
}

GitHub's Cite this repository button generates BibTeX and APA from CITATION.cff automatically for the most current release.

Papers

An Uncertainty-Aware Machine Learning Emulator for the Reionisation kSZ Power Spectrum, Robert Pearce and Paul La Plante, in preparation (2026).

Acknowledgments

Developed in the LEADS Lab at the University of Nevada, Las Vegas, under Dr. Paul La Plante, with computing resources from the Pittsburgh Supercomputing Center (Bridges-2).

Released under the MIT License.

Release files for reionemu 0.4.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 reionemu 0.4.0
File Size Uploaded
reionemu-0.4.0.tar.gz 363.8 kB Details

Built distribution (wheel)

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

Total release size: 402.7 kB

Release files / reionemu-0.4.0.tar.gz

Download URL reionemu-0.4.0.tar.gz
Size 363.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0b21ddef16abae70c0a20db2b9f12aabf8ad359abe181c8743652b6a2688054b
BLAKE2b-256 checksum
How to use checksums
0f47a59088308b7090e7b163741ca62d5e443acce03ba557c5d86741bced9b68
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 18, 2026.

Transparency log

Release files / reionemu-0.4.0-py3-none-any.whl

Download URL reionemu-0.4.0-py3-none-any.whl
Size 38.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5baca3da59622f73a1da26391bf5bfc2d5055e0f3ef1b372fabf1a902d50e5c
BLAKE2b-256 checksum
How to use checksums
e41f8d9a07b698d5ca50dd91aae0d982d6a0a9745ed20e9af23bb1579961218e
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 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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