一键导入
class
Drive CLASS v3.3.4 (via classy) for linear cosmology — background H(z), CMB Cℓ, P(k), transfer functions — for ΛCDM and upstream BSM extensions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Drive CLASS v3.3.4 (via classy) for linear cosmology — background H(z), CMB Cℓ, P(k), transfer functions — for ΛCDM and upstream BSM extensions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Numerically evaluate a FormCalc-reduced one-loop amplitude with LoopTools 2.16 (Passarino-Veltman integrals via the Wolfram/LoopTools MathLink) and emit a scattering/v1 JSON (σ_SI, σ_SD) for direct detection. Unblocks the 2HDM+a loop-only DD path. Self-heals via _shared/installs/looptools preflight.
Reduce a FeynArts amplitude list with FormCalc 9.10. Produces amp_reduced.m and amp_reduced.meta.json sidecar conforming to amp_reduced.meta/v1. Self-heals via _shared/installs/formcalc preflight.
Generate Feynman diagrams and amplitudes using FeynArts 3.11. Supports built-in models (SM, SMQCD, THDM, MSSM) and SARAH-generated models. Outputs FeynAmpList.m, diagrams.pdf, topologies.json, and metadata sidecar.
Compute direct-detection likelihoods and 90%-CL exclusion verdicts using DDCalc 2.2.0. Leaf consumer of scattering/v1 JSON from /micromegas or /formcalc.
MadDM — dark matter relic density, direct detection cross-sections, indirect detection rates, parameter scans with experimental limit comparison
Run HiggsBounds-5 + HiggsSignals-2 constraint checks on a model SLHA file. Computes hb_allowed (per-channel AND), hs_consistent (Δχ² < 6.18), p-values, and per-channel CSV. Supports single-point and scan-directory modes.
| name | class |
| description | Drive CLASS v3.3.4 (via classy) for linear cosmology — background H(z), CMB Cℓ, P(k), transfer functions — for ΛCDM and upstream BSM extensions. |
| version | 1.0.0 |
| subcommands | ["background","cmb","pk","transfer"] |
Drive CLASS v3.3.4 (Cosmic Linear Anisotropy Solving System) to compute
linear-cosmology observables for ΛCDM and BSM extensions that affect the
CMB or large-scale structure. Does not reimplement physics — all Boltzmann
computation is delegated to the classy Python wrapper.
Outputs validated against plugins/shared/schemas/cosmology.schema.json
(cosmology/v1). Run directory: $HEPPH_STATE_ROOT/cosmology_runs/<TS>/.
Before any other action, run:
bash plugins/hep-ph-toolkit/_shared/installs/class/detect.sh
config.class_path
is set. Proceed.plugins/hep-ph-toolkit/_shared/installs/class/INSTALL.md into context
and follow it. When the install completes, re-run detect.sh before
proceeding. If it still fails, halt and surface the blocker code from
the install reference.Invoke /class when:
config.class_path set) via the preflight above./dark-matter-constraints for cosmology side-checks
when a runner spec opts in via cosmology.kind != 'standard_thermal'./class background <preset> [options]
/class cmb <preset> [options]
/class pk <preset> [options]
/class transfer <preset> [options]
| Subcommand | Computes | Output file |
|---|---|---|
background | H(z), D_A(z), growth factor, Ω_i(z), thermodynamics | background.dat |
cmb | Lensed TT, TE, EE, BB, PP Cℓ up to --lmax | cls.dat |
pk | Linear matter P(k,z) at redshifts --z-pk | pk.dat |
transfer | Transfer functions T(k,z) at redshifts --z-pk | tk.dat |
All subcommands also write cosmology.json (validated against cosmology/v1).
| Preset | Description |
|---|---|
planck18 | Planck 2018 ΛCDM best-fit (TT,TE,EE+lowE+lensing) |
planck18_act | Planck 2018 + ACT DR4 joint best-fit |
custom | Requires --config <path> pointing to a YAML config file |
subcommand background|cmb|pk|transfer
preset planck18|planck18_act|custom
--config <path> YAML config file (required for preset=custom,
optional override for planck18/planck18_act)
--bsm <path> YAML BSM extension block (overrides preset's bsm_extension)
--output-dir <dir> Run output directory (default: $HEPPH_STATE_ROOT/cosmology_runs/<TS>/)
--lmax <int> Maximum multipole for CMB (default: 2500, cmb subcommand only)
--z-pk <str> Comma-separated redshifts for P(k)/transfer (default: "0")
--k-min <float> Minimum k [h/Mpc] (default: 1e-4)
--k-max <float> Maximum k [h/Mpc] (default: 1.0)
Pass a YAML file via --bsm with keys:
kind: dcdm # one of: dcdm, idm_baryon, idm_dr, idm_photon,
# exotic_injection, ncdm_extra
params:
Gamma_dcdm: 1.0e-29 # extension-specific CLASS ini keys
The kind and params are forwarded verbatim to CLASS as ini-file entries.
Only upstream lesgourg/class_public v3.x extensions are supported.
Per run: $HEPPH_STATE_ROOT/cosmology_runs/<TS>/
| File | Content |
|---|---|
cosmology.json | Run metadata; validated against cosmology/v1 schema |
cls.dat | CMB Cℓ TSV (# ell TT TE EE BB PP header); cmb only |
pk.dat | P(k,z) TSV (# k_h/Mpc Pk_z0 ...); k in h/Mpc, P in (Mpc/h)^3; pk only |
background.dat | Background quantities TSV; background only |
tk.dat | Transfer functions TSV (# k_h/Mpc d_cdm d_b d_tot); z=0 slice; transfer |
tk_z{z}.dat | Per-redshift transfer function slices (one per --z-pk value) |
class.ini | Rendered CLASS ini file used for the run |
stdout.log | Raw classy subprocess stdout |
stderr.log | Raw classy subprocess stderr |
P(k) units convention: k grid is sampled in h/Mpc as specified by --k-min/--k-max.
The classy pk_lin() call takes k in 1/Mpc (converted internally as k × h), and the
returned P [Mpc^3] is divided by h^3 so that P(k) is in (Mpc/h)^3, consistent with the
k_h/Mpc header. Transfer functions use classy's get_transfer(z) and emit δ_cdm,
δ_b, and δ_tot (total matter) at the k-grid returned by CLASS (already in h/Mpc).
TSV files use # col_a col_b ... header lines and deterministic
f"{x:.10e}" float formatting throughout.
| Config key | Source | Required for |
|---|---|---|
config.class_path | _shared/installs/class/INSTALL.md | All subcommands |
config.class_version | _shared/installs/class/INSTALL.md | All subcommands |
If class_path is not configured, the skill emits CLASS_NOT_CONFIGURED
(fatal) and halts.
| Code | Mode | Notes |
|---|---|---|
CLASS_NOT_CONFIGURED | fatal | class_path missing from config |
CLASS_CONFIG_INVALID | fatal | Malformed or unresolvable config YAML |
CLASS_INI_RENDER_FAILED | fatal | Template rendering failed |
CLASSY_IMPORT_FAILED | recoverable | classy Python package not importable; re-run /install class |
CLASS_COMPUTE_FAILED | recoverable | CLASS computation raised an exception; check ini params/stderr |
CLASS_RUNTIME_FAILURE | recoverable | Non-zero exit from classy subprocess with no structured code |
CLASS_OUTPUT_MISSING | fatal | Expected output file not produced by CLASS |
CLASS_SCHEMA_INVALID | fatal | cosmology.json failed schema validation |
CLASS_BSM_UNKNOWN_KIND | fatal | Unrecognised BSM extension kind |
The following are explicitly not supported by this skill:
class_sz — Sunyaev-Zel'dovich / cluster-count extensions./dark-matter-constraints auto-routing. /class is auto-invoked by
/dark-matter-constraints when a runner spec declares
cosmology.kind != 'standard_thermal'. The router invocation contract is
documented in dark-matter-constraints/SKILL.md Step 6. Cost disclosure:
background ≈ <1 s; cmb 5-30 s at default lmax; pk 2-10 s; transfer
<5 s; multi-subcommand runs add roughly linearly. Router default
invoke: [background] keeps overhead negligible. Other auto-routing
(CMB-likelihood frameworks, MCMC orchestrators) remains out of scope.| Script | Purpose |
|---|---|
scripts/run_class.py | CLI entry point; argparse, dispatch, config loading |
scripts/ini_render.py | Render YAML preset + BSM block → CLASS ini file |
scripts/classy_driver.py | Subprocess wrapper for classy; captures logs |
scripts/parse_outputs.py | Parse classy dict → TSV .dat files |
scripts/schema_validate.py | Validate cosmology.json against cosmology/v1 |
Unit tests are always-on (no network, no classy required).
The golden cl[2,'tt'] test is gated on HEPPH_RUN_NETWORK_TESTS=1.
See tests/test_smoke.py for the integration gate (cl[2,'tt'] within 5%
of tests/fixtures/planck18_cls_l2_to_l10.json, generated on Ubuntu 22.04
LTS with system gcc/libomp).
In scope:
Out of scope (v1):