From 61a00db52bfcf197ef69af3357b16d1598795b71 Mon Sep 17 00:00:00 2001 From: salman Date: Mon, 31 Aug 2026 19:18:14 +0200 Subject: [PATCH] Add singlehist and functions reference fixtures for beta.3 baseline - singlehist.generated.msr: SingleHist detector-normalization golden (fittype 0, four histogram groups, norm + map RUN blocks, detector-resolved phases). - functions.generated.msr: global-asymmetry golden carrying a FUNCTIONS block (fun1 = gamma_mu * Pfield) beside THEORY. - README: document both and note that 'missingdata' is a run-time concern (classifyMissingDataOutput), not a buildMSR() generation workflow, so it does not belong to the .generated.msr family. --- tests/fixtures/reference/README.md | 15 +++- .../reference/functions.generated.msr | 55 ++++++++++++ .../reference/singlehist.generated.msr | 79 ++++++++++++++++ tests/reference-fixtures.test.js | 90 +++++++++++++++++++ 4 files changed, 236 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/reference/functions.generated.msr create mode 100644 tests/fixtures/reference/singlehist.generated.msr diff --git a/tests/fixtures/reference/README.md b/tests/fixtures/reference/README.md index 822f746..06306b7 100644 --- a/tests/fixtures/reference/README.md +++ b/tests/fixtures/reference/README.md @@ -28,9 +28,18 @@ The naming records the workflow: converged `chisq/NDF 1.034138` (NDF 8198). Because the run-family THEORY shares parameters through `mapN`, `parseMSRTheoryModel` deliberately refuses to reconstruct it (safe guard, editor-owned) — the test asserts that refusal. -- *Pending:* `singlehist.generated.msr` (needs a detector-normalization model - to avoid `norm undefined`), `functions.generated.msr`, - `missingdata.generated.msr`. +- `singlehist.generated.msr` — SingleHist detector-normalization workflow + (fittype 0): four histogram groups each with its own `No`/`NBg` normalization + and a detector-resolved phase, so the RUN blocks carry `norm` + `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 a `FUNCTIONS` block alongside THEORY. + +> `missingdata` was on the original pending list but is **not** a `.generated.msr` +> workflow: `buildMSR()` has no "missing data" output. Missing data is a +> run-time concern (`classifyMissingDataOutput` reads 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 diff --git a/tests/fixtures/reference/functions.generated.msr b/tests/fixtures/reference/functions.generated.msr new file mode 100644 index 0000000..95d4eff --- /dev/null +++ b/tests/fixtures/reference/functions.generated.msr @@ -0,0 +1,55 @@ + +# Run Numbers: 2452-2460 +############################################################### +FITPARAMETER +############################################################### +# No Name Value Step PosErr Min Max + 1 Alpha_2452 0.9077 0.0016 + 2 Asy_2452 0.0915 0.0016 + 3 Sgm_2452 0.132 0.013 + 4 Phi 16.91 0.85 + 5 Pfield_2452 100 1 + +############################################################### +THEORY +asymmetry 2 +simpleGss 3 +TFieldCos 4 fun1 +############################################################### +FUNCTIONS +fun1 = gamma_mu * par5 +############################################################### + +GLOBAL +fittype 2 +fit 0.07 9 +packing 50 + +############################################################### +RUN /mnt/fake/lem/his/2026/lem26_his_2452 MUE4 PSI MUSR-ROOT +alpha 1 +forward 21 25 +backward 23 27 +############################################################### +COMMANDS +MAX_LIKELIHOOD +MINIMIZE +HESSE +SAVE +############################################################### +PLOT 2 +runs 1 2 3 4 5 6 7 8 9 +range 0 11 -0.3 0.3 +view_packing 500 + +############################################################### +FOURIER +units Gauss +fourier_power 12 +dc-corrected FALSE +apodization STRONG +plot power +range 0 11 + +############################################################### +# Created by muSRFlow (ZS https://bitbucket.org/zaher-salman/musrfit-gui) diff --git a/tests/fixtures/reference/singlehist.generated.msr b/tests/fixtures/reference/singlehist.generated.msr new file mode 100644 index 0000000..530396f --- /dev/null +++ b/tests/fixtures/reference/singlehist.generated.msr @@ -0,0 +1,79 @@ + +# Run Numbers: 2452 +############################################################### +FITPARAMETER +############################################################### +# No Name Value Step PosErr Min Max + 1 No1_2452 300 3 + 2 NBg1_2452 30 0.3 + 3 No2_2452 300 3 + 4 NBg2_2452 30 0.3 + 5 No3_2452 300 3 + 6 NBg3_2452 30 0.3 + 7 No4_2452 300 3 + 8 NBg4_2452 30 0.3 + 9 Asy_2452 0.09 0.01 + 10 Sgm_2452 0.13 0.01 + 11 Phi_2452 16.9 0.8 + 12 Frq_2452 1.36 0.01 + 13 PhiH2_2452 1 0.01 + 14 PhiH3_2452 1 0.01 + 15 PhiH4_2452 1 0.01 + +############################################################### +THEORY +asymmetry 9 +simpleGss 10 +TFieldCos map1 12 + +GLOBAL +fittype 0 +fit 0.07 9 +packing 50 + +############################################################### +RUN /mnt/fake/lem/his/2026/lem26_his_2452 MUE4 PSI MUSR-ROOT +norm 1 +forward 21 25 +map 11 +backgr.fit 2 +RUN /mnt/fake/lem/his/2026/lem26_his_2452 MUE4 PSI MUSR-ROOT +norm 3 +forward 23 27 +map 13 +backgr.fit 4 +RUN /mnt/fake/lem/his/2026/lem26_his_2452 MUE4 PSI MUSR-ROOT +norm 5 +forward 22 26 +map 14 +backgr.fit 6 +RUN /mnt/fake/lem/his/2026/lem26_his_2452 MUE4 PSI MUSR-ROOT +norm 7 +forward 24 28 +map 15 +backgr.fit 8 + +############################################################### +COMMANDS +MAX_LIKELIHOOD +MINIMIZE +HESSE +SAVE +############################################################### +PLOT 0 +runs 1 2 3 4 +range 0 11 -0.3 0.3 +view_packing 500 +lifetimecorrection + +############################################################### +FOURIER +units Gauss +fourier_power 12 +dc-corrected FALSE +apodization STRONG +plot power +range 0 11 + +############################################################### +# Created by muSRFlow (ZS https://bitbucket.org/zaher-salman/musrfit-gui) diff --git a/tests/reference-fixtures.test.js b/tests/reference-fixtures.test.js index 57128aa..03637b4 100644 --- a/tests/reference-fixtures.test.js +++ b/tests/reference-fixtures.test.js @@ -153,6 +153,96 @@ const fixtures = { { value: "Frq", disabled: false } ], sharedFlags: { Phi: true } + }), + // SingleHist detector-normalization workflow: four histogram groups each + // with its own No/NBg normalization and a detector-resolved phase, so the + // RUN blocks carry norm + map rather than a single asymmetry forward count. + "singlehist": withConfig({ + fitAsyType: "SingleHist", + Tis: "0.07", + Tfs: "9", + BINS: "50", + minType: "MINIMIZE", + fitObjective: "MAX_LIKELIHOOD", + fftUnits: "Gauss", + fftType: "power", + fftPhase: "", + fftPhaseCorrection: "off", + fftxi: "0", + fftxf: "11", + Tpis: "0", + Tpfs: "11", + Ypis: "-0.3", + Ypfs: "0.3", + VIEWBINS: "500", + plotLifetimeCorrection: "1", + theoFunBlock: "asymmetry Asy\nsimpleGss Sgm\nTFieldCos Phi Frq", + runNumbers: "2452", + selYear: "2026", + instrName: "LEM", + dataRoot: "/mnt/fake", + LRBF: "21 25,23 27,22 26,24 28", + minAsy: "", maxAsy: "", + valAsy_2452: "0.09", errAsy_2452: "0.01", + valSgm_2452: "0.13", errSgm_2452: "0.01", + valPhi: "16.9", errPhi: "0.8", + valFrq_2452: "1.36", errFrq_2452: "0.01" + }, { + funOptions: [ + { value: "No1", disabled: false }, { value: "NBg1", disabled: false }, + { value: "No2", disabled: false }, { value: "NBg2", disabled: false }, + { value: "No3", disabled: false }, { value: "NBg3", disabled: false }, + { value: "No4", disabled: false }, { value: "NBg4", disabled: false }, + { value: "Asy", disabled: false }, { value: "Sgm", disabled: false }, + { value: "Phi", disabled: false }, { value: "Frq", disabled: false }, + { value: "PhiH2", disabled: false }, + { value: "PhiH3", disabled: false }, + { value: "PhiH4", disabled: false } + ] + }), + // FUNCTIONS workflow: frequency expressed through a custom field parameter + // (fun1 = gamma_mu * Pfield), so the generated MSR carries a FUNCTIONS block. + "functions": withConfig({ + fitAsyType: "AsymmetryGLB", + Tis: "0.07", + Tfs: "9", + BINS: "50", + minType: "MINIMIZE", + fitObjective: "MAX_LIKELIHOOD", + fftUnits: "Gauss", + fftType: "power", + fftPhase: "", + fftPhaseCorrection: "off", + fftxi: "0", + fftxf: "11", + Tpis: "0", + Tpfs: "11", + Ypis: "-0.3", + Ypfs: "0.3", + VIEWBINS: "500", + theoFunBlock: "asymmetry Asy\nsimpleGss Sgm\nTFieldCos Phi Frq", + runNumbers: "2452-2460", + selYear: "2026", + instrName: "LEM", + dataRoot: "/mnt/fake", + LRBF: "21 25,23 27", + minAlpha: "", maxAlpha: "", minAsy: "", maxAsy: "", + valAlpha_2452: "0.9077", errAlpha_2452: "0.0016", + valAsy_2452: "0.0915", errAsy_2452: "0.0016", + valSgm_2452: "0.132", errSgm_2452: "0.013", + valPhi: "16.91", errPhi: "0.85", + valPfield: "100", errPfield: "1" + }, { + funOptions: [ + { value: "Alpha", disabled: false }, + { value: "Asy", disabled: false }, + { value: "Sgm", disabled: false }, + { value: "Phi", disabled: false }, + { value: "Frq", disabled: true }, + { value: "Pfield", disabled: false } + ], + funLines: ["Frq = gamma_mu * Pfield"], + sharedFlags: { Phi: true } }) };