Predicting¶
One call does everything: reg.predict(property, gravity, redshift, theta, **kw).
import os; os.environ.setdefault("JAX_PLATFORMS", "cpu")
import numpy as np
from haloemu import get_registry
reg = get_registry()
th = [0.31, 0.677, 0.967, 0.83] # LCDM
th5 = [0.31, 0.677, 0.967, 0.83, -5.0] # fRn1
One-liner per property¶
n = reg.predict("hmf", "LCDM", 0.25, th) # (1, 23) n(>M), (Mpc/h)^-3
b = reg.predict("b_cum", "LCDM", 0.25, th) # (1, 30) b(>M) (fRn1: 31)
pk = reg.predict("pk_mm", "LCDM", 0.25, th) # (1, 147) P(k), (Mpc/h)^3
xi = reg.predict("xi_mm", "LCDM", 0.25, th) # (1, 113) xi(r), SIGNED
rab = reg.predict("r_ab", "LCDM", 0.25, th) # (1, 30, 30) threshold-pair matrix
m10 = reg.predict("vel_m10", "LCDM", 0.25, th) # (1, 91, 37) mass-pair x r surface
vb = reg.predict("vel_binned", "LCDM", 0.25, th,
mass_edges=[12.5, 13.0, 13.5]) # dict: {moment: (Nbin, Nbin, 37)}
bd = reg.predict("b_diff", "LCDM", 0.25, th) # dict: x_grid, b_diff, b_err, cov, checks
xhh = reg.predict("xi_hh", "LCDM", 0.25, th) # dict, see below
Same calls with "fRn1" and a 5-parameter θ (exception: vel_c12 is
ΛCDM-only, and vel_binned returns NaN for f(R) c12).
Coordinates, variance, and surfaces¶
art = reg.load(prop, gravity, z)
art.coord # 1-D grid (log10M edges / k / r)
reg.predict(prop, gravity, z, th, return_var=True) # (mean, variance) for trained emulators
# surface emulators carry extra axes:
reg.load("r_ab", gravity, z).thresholds # both matrix axes
reg.load("vel_m10", gravity, z).pair_keys # mass-bin pairs
reg.load("vel_m10", gravity, z).r # radial grid
xi_hh — custom bins and routes¶
res = reg.predict("xi_hh", "LCDM", 0.25, th,
edges=np.array([13.0, 13.3, 13.6]), # your log10M bin edges
r=np.geomspace(3, 90, 40), # custom radii (optional)
route="auto") # auto | exact | bbar
res["xi_hh"] # (Nbin, Nbin, Nr)
res["validity"] # per-gravity acceptance-test evidence — READ IT
route="exact"(default viaauto): validated r ∈ [1.3, 100] with per-pair validity floors; belowvalidity["r_valid_bin"][i, j]the value is a flat clamp at the boundary prediction (halo exclusion — reported, not predicted), never NaN.route="bbar": factorization, only good r ∈ [20, 70].- r below ~1.25 or above the
xi_mmsupport (124.8) raises.
b_cum at arbitrary masses¶
art = reg.load("b_cum", "LCDM", 0.25)
b = art.predict_mass(th, np.array([13.2, 14.3])) # Tinker-anchored above log10M=14
CLI equivalent¶
micromamba run -n cosemu python3 -m haloemu.cli predict xi_mm \
--gravity fRn1 --redshift 0.25 --theta 0.31,0.677,0.967,0.83,-5
micromamba run -n cosemu python3 -m haloemu.cli predict b_diff \
--theta 0.31,0.677,0.967,0.83 --out b_diff.hdf5
Checklist before you trust a number¶
- θ in the right order, with S_8 not σ_8 (conventions).
- θ inside the design ranges.
- Redshift registered (z = 0.25 everywhere; z = 0 for the matter sector only).
- For ξ/ξ_hh: respect the masks and validity windows; mind the frozen-seed offset.