This release is a pre-release and may not be stable for production use.
cmbemu
A CMB power-spectrum emulator competition: pre-generated training/test data,
Wishart-likelihood scoring, and a CPU timing harness built on
classy_sz / classy_szfast.
Install
pip install cmbemu
Requires Python ≥ 3.12.
Quickstart
import cmbemu as cec
# 1. Fetch the competition data (cached under ~/.cache/cmbemu)
train = cec.load_train()
test = cec.load_test()
# 2. Define your emulator: any object exposing predict(dict) -> dict
class MyEmulator:
def predict(self, params: dict):
# params keys: omega_b, omega_cdm, H0, tau_reio, ln10^{10}A_s, n_s
# return dict with keys tt/te/ee (len 6001) and pp (len 3001)
...
emu = MyEmulator()
# 3. Score it
result = cec.get_score(emu)
print(result["combined_S"], result["mae_total"]["mae"])
See idea.md for the competition rules and
data_description.md for the dataset schema.
The scoring API
Three parallel entry points, one per component of the score:
| Function | Returns | Cost per call | When to use |
|---|---|---|---|
get_accuracy_score |
mae_total, mae_cmb, mae_pp |
~2 s (run emulator on the 5 000 test points) | every training epoch |
get_time_score |
t_cpu_ms_mean/median/std, ... |
~n_calls × per-call ms |
after the model is frozen |
get_score |
both of the above plus combined_S |
sum of the two | at submission time |
acc = cec.get_accuracy_score(emu) # precision only
tim = cec.get_time_score(emu) # timing only
full = cec.get_score(emu) # both + combined_S
What combined_S is
The single scalar leaderboard number. With $E$ = mae_total (the precision MAE),
$T$ = mean CPU time per call in ms, $T_0$ = t_floor_ms (default 1 ms),
$\alpha$ = alpha (default 1):
$$ S ;=; \log_{10}(E) ,+, \alpha \cdot \log_{10}(\max(T,, T_0)) $$
Lower is better. Above the floor, one decade of precision trades for one decade of speed; sub-millisecond inference buys no further credit (MCMC per-step overhead dominates below that scale).
Precision and speed are cleanly decomposed: you can recompute combined_S
from the two sub-scores yourself:
acc = cec.get_accuracy_score(emu)
tim = cec.get_time_score(emu)
S = cec.combined_score(acc["mae_total"]["mae"], tim["t_cpu_ms_mean"])
See idea.md for the full Wishart derivation, block
decomposition, and rationale for MAE over MSE.
CPU timing setup
Timing is done CPU-only, single-threaded, warm, with fresh parameters at every call (no result caching possible). Before importing your emulator:
export JAX_PLATFORMS=cpu
export CUDA_VISIBLE_DEVICES=
Pass strict_cpu=True to get_time_score / get_score to make the check a
hard failure rather than a warning.
Generate more data (optional)
Want to study how your architecture's precision scales with $N_\text{train}$? Draw more cosmologies from the same prior:
extra = cec.generate_data(n=20_000, seed=42, save_to="extra.npz")
Baselines
Two trivial emulators ship with the package for sanity checks:
emu1 = cec.ConstantPlanck() # always returns Planck fiducial
emu2 = cec.NearestNeighbour(cec.load_train()) # 1-NN lookup on training set
Expected ConstantPlanck → combined_S ≈ 7.05 on the full test set. Any
real emulator should beat this on precision by many decades.
Project layout
src/cmbemu/— the installable packagescripts/— internal dataset-building and diagnostic toolsidea.md— competition pitchdata_description.md— dataset schema + loading patternsSTATUS.md— current state of the competition design
Metadata
Release files for cmbemu 0.1.0a2
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 | |
|---|---|---|---|---|
| cmbemu-0.1.0a2.tar.gz | 19.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cmbemu-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.8 kB
Release files / cmbemu-0.1.0a2.tar.gz
| Download URL | cmbemu-0.1.0a2.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ff5a05b9bc9193801d624ac026572c3024ff27f6c124859e58efdb0d9b585bd
|
|
BLAKE2b-256 checksum How to use checksums |
1ccf7c2efe7d35df10e41589f23a1692c912bd188d0f32d17b9347df14f2b703
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 22, 2026.
Transparency logRelease files / cmbemu-0.1.0a2-py3-none-any.whl
| Download URL | cmbemu-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 24.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
952a96b89f9c5785448c2aa83386e9431569cae5137489f4cfd82d8d296825ff
|
|
BLAKE2b-256 checksum How to use checksums |
3c47d19be92ae2bb67419d0c526e51338ab879b928cb734852b6028b8f319ed9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 22, 2026.
Transparency logSecurity for cmbemu 0.1.0a2
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for cmbemu-0.1.0a2.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 Apr 22, 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.