- tests/integration-musrfit.test.js stages each single-run .generated.msr fixture (data path rewired to the fake tree), runs real 'musrfit -e', and asserts the fitted STATISTIC block matches the recorded converged value (asymmetry 39.776426, bounds 60.869627, t0/background 5.602355, NDF 406). It also round-trips every .fitted.msr fixture through parseMSRFitStatistic. Gated on the musrfit binary + fake data; prints a skip notice otherwise. - Wire into the npm test script; document in the reference fixtures README. - Mark the beta.3 fixture, integration, and title-handling TODO gates done.
3.6 KiB
Reference fixtures
Golden MSR files captured from fixed muSRFlow GUI configurations. Each
<name>.generated.msr is the byte-for-byte output of buildMSR() for a
deterministic configuration and is verified hermetic by
tests/reference-fixtures.test.js (no musrfit required).
The naming records the workflow:
asymmetry.generated.msr— single-run Asymmetry fit with bounds and an FFT block (the canonical export path).bounds.generated.msr— Asymmetry fit with tight explicit bounds and the FFT block disabled.t0background.generated.msr— Asymmetry fit with fixed forward/backward t0 and fixed background values.singlehist.fitted.msr— a real SingleHist fit result (fittype 0,GaussianCosmodel, 16 fitted parameters, convergedSTATISTICblock withmaxLH/NDF 1.04011, NDF 3644) captured from production. It is the anchor for the reverse-parsing path:tests/reference-fixtures.test.jsverifies that muSRFlow reads it back into GUI state (parseMSRFitStatistic,parseMSRParameters,parseMSRTheoryModel,parseMSRGUISettings).global.generated.msr— global-asymmetry fit (AsymmetryGLB, fittype 2) over runs 2452-2460 with theGaussianCosmodel and a shared phasePhi. The generator emits a single-RUN template (run 2452) thatmsr2datalater expands to all nine runs; the FITPARAMETER already carries the shared + per-run set.global.fitted.msr— the real global fit result over runs 2452-2460: 37 fitted parameters (one sharedPhi+ 9 runs xAlpha/Asy/Sgm/Frq), convergedchisq/NDF 1.034138(NDF 8198). Because the run-family THEORY shares parameters throughmapN,parseMSRTheoryModeldeliberately refuses to reconstruct it (safe guard, editor-owned) — the test asserts that refusal.singlehist.generated.msr— SingleHist detector-normalization workflow (fittype 0): four histogram groups each with its ownNo/NBgnormalization and a detector-resolved phase, so the RUN blocks carrynorm+map.functions.generated.msr— global-asymmetry workflow where the frequency is expressed through a custom field parameter (fun1 = gamma_mu * Pfield), so the generated MSR carries aFUNCTIONSblock alongside THEORY.
missingdatawas on the original pending list but is not a.generated.msrworkflow:buildMSR()has no "missing data" output. Missing data is a run-time concern (classifyMissingDataOutputreads musrfit output that says a data file was not found) and belongs to the integration/runner side, not the hermetic generation goldens.
Regenerating a fixture
Edit the corresponding config in tests/reference-fixtures.test.js, write the
new buildMSR() output to <name>.generated.msr, and re-run the test. Only do
this when the generator change is intentional; otherwise the test guards against
unexpected drift. The real-fitted counterparts (.fitted.msr) used by the
later integration checks are produced by running musrfit on the generated MSR
against the configured data root.
Integration checks
tests/integration-musrfit.test.js is gated on the presence of the real
musrfit binary and the fake data tree. When both are present it stages each
single-run .generated.msr fixture (rewiring its data path to the on-disk fake
data), runs musrfit -e, and asserts the fitted MSR's STATISTIC block matches
the recorded converged value (asymmetry 39.776426, bounds 60.869627,
t0/background 5.602355, all NDF 406). It also round-trips every .fitted.msr
fixture through parseMSRFitStatistic. Without the tools it prints a skip
notice and exits successfully so the hermetic suite stays runnable on a bare
CI box.