From 59e6dd12ea9d74e019fdf0718c94e5afcb57fa4e Mon Sep 17 00:00:00 2001 From: salman Date: Thu, 10 Sep 2026 13:57:48 +0200 Subject: [PATCH] Show on-disk statistics for reused/skipped runs in the series table collectSeriesStatisticRows read entry.statistic, but plan entries place the parsed MSR statistic on entry.classification.statistic, so skip/reuse rows rendered as empty. Read the classification copy first (entry.statistic kept as a fallback) so every selected data set reports the values already extracted from its MSR, matching what is plotted. --- muSRFitlib.js | 7 ++++++- tests/series-statistic.test.js | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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) {