Metadata-Version: 2.4
Name: cmbemu
Version: 0.1.0a1
Summary: CMB-spectrum emulator competition: pre-generated training data, Wishart-likelihood scoring, and CPU timing harness built on classy_szfast.
Project-URL: Homepage, https://github.com/borisbolliet/cmbemu
Project-URL: Repository, https://github.com/borisbolliet/cmbemu
Author: Vivian Poulin
Author-email: Boris Bolliet <boris.bolliet@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: CMB,benchmark,cosmology,emulator,jax
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Astronomy
Requires-Python: >=3.12
Requires-Dist: classy-sz>=0.1.70
Requires-Dist: huggingface-hub>=0.23
Requires-Dist: jax>=0.4.30
Requires-Dist: matplotlib>=3.8
Requires-Dist: numpy>=1.26
Requires-Dist: scipy>=1.12
Requires-Dist: tqdm>=4.66
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Provides-Extra: gpu
Requires-Dist: jax[cuda12]>=0.4.30; extra == 'gpu'
Description-Content-Type: text/markdown

# cmbemu

A CMB power-spectrum emulator competition: pre-generated training/test data,
Wishart-likelihood scoring, and a CPU timing harness built on
[`classy_sz`](https://pypi.org/project/classy_sz/) / `classy_szfast`.

## Install

```bash
pip install cmbemu
```

## Quickstart

```python
import cmbemu as cec

# (1) Fetch the pre-generated datasets (cached under ~/.cache/cmbemu)
train = cec.load_train()
test  = cec.load_test()

# (2) Optionally generate more spectra to study data-scaling
extra = cec.generate_data(n=20_000, seed=42, save_to="extra.npz")

# (3) Define your emulator
class MyEmulator:
    def predict(self, params: dict) -> dict:
        # params has keys: omega_b, omega_cdm, H0, tau_reio,
        # ln10^{10}A_s, n_s.
        # Returns a dict with keys tt, te, ee (len lmax_cmb+1)
        # and pp (len lmax_pp+1).
        ...

# (4) Score
result = cec.get_score(MyEmulator())
print(result["combined_S"], result["mae_total"]["mae"], result["timing"]["t_cpu_ms_mean"])
```

See `scoring.md` for the full likelihood and score definitions.

## Hardware note

Timing is done **CPU-only**, single-threaded warm sequential calls — this
mimics how an emulator is used inside a typical MCMC chain. Before running
`get_score` with `strict_cpu=True`, export:

```bash
export JAX_PLATFORMS=cpu
export CUDA_VISIBLE_DEVICES=
```

## Project layout

- `src/cmbemu/` — the installable package
- `scripts/` — internal dataset-building and diagnostic scripts
- `scoring.md` — formal score definition
- `STATUS.md` — current state of the competition design
