Skip to content

Agent guide

This page is written for AI coding agents (Claude Code and similar) operating in this repository. It is deliberately terse and rule-shaped. The companion machine reference is a flat fact table; a machine index lives at /llms.txt.

Ground rules (do not violate)

  1. Environment: always micromamba run -n cosemu python3 …. The package imports from anywhere in that env — no cwd/sys.path games.
  2. Silence the GPU probe: os.environ.setdefault("JAX_PLATFORMS", "cpu") before importing haloemu. The CUDA 303 error otherwise printed is harmless.
  3. Heavy compute → slurm (account dp004, partition cosma8-serial). Never train, sweep, or measure catalogues on the login node. Chain jobs with --dependency=afterok. Single predictions are milliseconds — fine inline.
  4. θ uses S_8, not σ_8: S_8 = sigma_8 * sqrt(Omega_m/0.3). This is the most common silent error.
  5. Edit scope: only edit files in this repository (halobias). Do not edit halocat or freyja — they are separate packages.
  6. Commit only when asked. Repo is single-author on main, no remote.
  7. Catalogue measurement gotcha: never call halocat ξ_AB assemblers bare — use discover_xi_AB_grid + aligned_r_edges + thresholds=, or pycorr silently re-measures and overwrites caches.

The 90 % task: predict

import os; os.environ.setdefault("JAX_PLATFORMS", "cpu")
from haloemu import get_registry
reg = get_registry()
y = reg.predict(prop, gravity, z, theta)   # the whole API
  • prop ∈ {hmf, b_cum, b_diff, pk_mm, xi_mm, xi_hh, xi_hh_smallr, r_ab, vel_m10, vel_c20, vel_c02, vel_c12, vel_c30, vel_c40, vel_c04, vel_c22}
  • gravity ∈ {LCDM, fRn1}; z ∈ {0.25, and 0.00 for hmf/pk_mm/xi_mm}
  • theta = [Omega_m, h, n_s, S_8] (+ logf_R0 for fRn1)

Shapes, units, ranges, and per-property kwargs: machine reference.

Before trusting output

  • θ inside the design hull (else unvalidated extrapolation).
  • Redshift registered (snapping tolerance is 0.005).
  • ξ / ξ_hh: respect masks, validity windows, and the frozen-seed +2–3 % large-scale offset (open for ξ, closed for pk_mm).
  • Velocity / ξ-near-BAO accuracy is χ = residual/SEM, not fractional.

Full list: Caveats.

Where the truth lives (don't guess numbers)

Need Source
Live registered keys + accuracy haloemu list / reg.entry(...)
Calling conventions this site, and .claude/skills/predicting-halo-properties/
Every gate number, derivations doc/emulation_methods.pdf (.tex)
Design rationale SUITE_DESIGN.md, DOCUMENTATION.md
Provenance per artifact haloemu/manifest.json

The Claude Code skill predicting-halo-properties is the canonical, auto-loaded version of the calling conventions; haloemu_skills.md is its human export. Keep the two in sync if you edit either.

Reproducing / extending accuracy

Numbers come from harnesses in haloemu/properties/ with matching *.slurm (pk_xi_validation.py, fRn1_fiducial_oos.py, ablation_sweep.py, velocity_ablation.py, …). See Training & CLI and Accuracy & gates. Several routes are recorded as rejected — read Accuracy → Rejected routes before re-implementing anything.