Verifying an installation — the self-test¶
PYTHONPATH=.:gui python -m linac_gen reliability selftest
PYTHONPATH=.:gui python -m linac_gen reliability selftest --regression --before /tmp/snap_before [--cases fodo_cell,bend_line]
The self-test runs a quick campaign on a scratch copy of the shipped demo deck
(examples/reliability_demo/) and checks 58 facts against truth.json,
whose answers the deck generator computes with its own kinematics, no HELIX
import: the parser is clean and the generator reproduces the committed files
byte for byte; the envelope exit energy, the four re-phased and the four
frozen-phase cavity-off deficits and the four RF-clock pins; the frozen
baseline is bit-identical to the re-phased one; a solenoid off leaves the
energy exactly; steerers are non-critical; the top cavity and its k = 1
neighbours; the compensation recovers; seed-0 orbit correction converges;
faults on seeds; the foil spot, mean loss and Highland angle; the stripping
anchors (labelled calibration, not truth); the availability closed forms,
the Monte Carlo within 3.5 σ and the deterministic-recovery bin; the report's
embedded figure. A pinned baseline
(tests/reliability/fixtures/reliability_selftest_baseline.npz, regenerated by
tests/reliability/regen_reliability_selftest_baseline.py from the reference
tree, with the machine, deck digest, version and git revision recorded) is
compared within one platform-libm ulp by default and bit for bit with
HELIX_BASELINE_EXACT=1.
--regression --before DIR proves that nothing that already worked changed:
the public control cases of scripts/physics_fix_report.py (thirteen decks,
envelope / matrix / multiparticle) are re-run in process and compared bit for
bit with a snapshot of the reference tree taken by
PYTHONPATH=/path/to/before python3 scripts/physics_fix_report.py snapshot --tree /path/to/before --out /tmp/snap_before
Verdicts: PASS (exit 0), FAIL (a check failed or a control case changed;
exit 1), REFUSED (the comparison could not be completed — no snapshot, a
control case missing, skipped or erroring; exit 1); --json prints the
result as a document. The self-test's own tests (tests/reliability/) run in
CI on the three platforms.