From f9d19bc57a226c2c02c78de2b1f7773ebcead884 Mon Sep 17 00:00:00 2001 From: salman Date: Sat, 10 Oct 2026 17:29:00 +0200 Subject: [PATCH] Add prompt-peak t0 estimation preference for non-LEM data The Electron Preferences dialog gains an "Estimate t0 from the prompt peak (non-LEM data)" option (on by default). For local fits of non-LEM instruments, muSRFlow now runs 'musrt0 --getT0FromPromptPeak' before 'musrfit' to write explicit t0 lines from the histogram peak into the generated MSR; the step is skipped automatically for LEM data and when the preference is disabled. The preference is stored locally and wired through save/open/cancel. Documentation and CHANGELOG updated; new electron tests cover the gating behavior, and existing tests adjusted to work with the added pre-step. --- CHANGELOG.md | 6 + docs/source/preferences.rst | 7 ++ index.html | 7 +- muSRFitelec.js | 72 ++++++++++- muSRFitlib.js | 38 ++++++ tests/electron-missing-data.test.js | 12 ++ tests/electron-t0-prompt-peak.test.js | 170 ++++++++++++++++++++++++++ 7 files changed, 305 insertions(+), 7 deletions(-) create mode 100644 tests/electron-t0-prompt-peak.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 47f3845..cc45700 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,12 @@ release path documented in [`TODO.md`](TODO.md). ignored by the web edition (fits run on the server). This mirrors the thread-count preference in musredit and is useful on shared workstations. +- The Electron **Preferences** dialog now includes an **Estimate t0 from the + prompt peak (non-LEM data)** option (on by default). For local fits of + non-LEM instruments, muSRFlow runs `musrt0 --getT0FromPromptPeak` before + `musrfit` to write explicit `t0` lines from the histogram peak into the + generated MSR; the step is skipped automatically for LEM data. + ## 1.0.0-rc.4 (2026-09-23) ### Parameter ordering diff --git a/docs/source/preferences.rst b/docs/source/preferences.rst index 865c621..84ec028 100644 --- a/docs/source/preferences.rst +++ b/docs/source/preferences.rst @@ -43,6 +43,13 @@ Initial parameters sensible starting values (for example an approximate frequency or asymmetry) instead of generic defaults. + **Estimate t0 from the prompt peak (non-LEM data)** (on by default): before a + local fit, muSRFlow runs ``musrt0 --getT0FromPromptPeak`` to write explicit + ``t0`` lines into the generated MSR. This forces musrfit to use the + histogram peak as the time-zero for instruments whose data-file header t0 is + unreliable; the step is skipped automatically for LEM data. Uncheck it to + preserve the MSR as generated. + Output file suffixes The suffixes appended to generated artifacts: **Asymmetry** (default ``_asy``) and **Single histogram** (default ``_singleHist``). Change diff --git a/index.html b/index.html index 2ed6d85..a21288d 100644 --- a/index.html +++ b/index.html @@ -25,7 +25,7 @@ muSRFlow - +
@@ -776,6 +776,11 @@ pairs of a multi-run (global) fit."> Guess initial parameters from first-run header + + Before a local fit, run musrt0 --getT0FromPromptPeak so t0 is written from the histogram peak. Applies to every instrument except LEM, whose data file already carries a reliable t0.
Output file suffixes