diff --git a/muSRFitlib.js b/muSRFitlib.js index 723f2dc..646e859 100644 --- a/muSRFitlib.js +++ b/muSRFitlib.js @@ -2638,7 +2638,12 @@ function applySeriesFitStatistic(rows) { function collectSeriesStatisticRows(plan) { if (!plan || !Array.isArray(plan.entries)) return []; return plan.entries.map(function(entry) { - let stat = entry.statistic || {}; + // The plan classifies every selected data set and caches its parsed on-disk + // statistic there; skip/reuse rows keep the values from the MSR used for + // plotting so the per-run table shows them too. + let classification = entry.classification || {}; + let stat = classification.statistic && typeof classification.statistic === "object" + ? classification.statistic : (entry.statistic || {}); return { run: entry.run, action: entry.action || "fit", diff --git a/tests/series-statistic.test.js b/tests/series-statistic.test.js index 643c0ca..786d814 100644 --- a/tests/series-statistic.test.js +++ b/tests/series-statistic.test.js @@ -140,6 +140,25 @@ function testCollectSeriesStatisticRows(lib) { assert.strictEqual(rows[1].action, "fit"); assert.strictEqual(lib.collectSeriesStatisticRows({ entries: [] }).length, 0); assert.strictEqual(lib.collectSeriesStatisticRows(null).length, 0); + + // Real plan entries carry the parsed on-disk statistic on classification, + // not on the entry itself. Reused/skipped rows must surface those values. + const reused = lib.collectSeriesStatisticRows({ + entries: [{ + run: 2537, action: "skip", + classification: { + statistic: { found: true, converged: true, kind: "chisq", + value: "0.87", ndf: "100", text: "χ²/NDF 0.87" } + }, + msrPath: "/work/2537_asy.msr" + }] + })[0]; + assert.strictEqual(reused.text, "χ²/NDF 0.87"); + assert.strictEqual(reused.kind, "chisq"); + assert.strictEqual(reused.value, "0.87"); + assert.strictEqual(reused.ndf, "100"); + assert.strictEqual(reused.found, true); + assert.strictEqual(reused.converged, true); } async function testSynchronizeSeriesStatistics(lib) {