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, 10, 60) mass-pair x r surface
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 θ.
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 artifacts
# surface artifacts 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 gate evidence — READ IT
route="exact"(default viaauto): validated r ∈ [2.2, 100]; NaN inside the small-r halo-exclusion wedge is physics.route="bbar": factorization, only good r ∈ [20, 70].- r outside the
xi_mmsupport [2.04, 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.