Add bundled ROOT + musrfit runtime resolution and build recipe

Packaged desktop builds can now carry a self-contained ROOT + musrfit
runtime under <resources>/runtime. muSRFitelec.js detects it only when
bin/musrfit or bin/musrt0 is present, prefers it over the host
installation (still yielding to a user-configured musrfit binaries
directory), and spawns tools with ROOTSYS, MUSRFITPATH, LD_LIBRARY_PATH,
and PATH pointed at the bundle. When the bundle is absent the previous
host-installation behaviour is unchanged.

packaging/runtime builds the tree in a low-glibc manylinux container,
rewrites runpaths to $ORIGIN-relative paths, bundles the non-system
shared-library closure, and ships a default musrfit_startup.xml. The
tree is git-ignored and delivered through the electron-builder
extraResources entry.

Add tests/electron-bundled-runtime.test.js and update CHANGELOG,
platforms.rst, and preferences.rst (Sphinx HTML/PDF rebuilt).
This commit is contained in:
salman committed 2026-10-11 16:54:57 +02:00
1 parent ee49679ee5
commit 9aeaa35838
25 files changed
+827 -74

No files matched your search

+5
View File
@@ -51,6 +51,10 @@ Thumbs.db
# Electron/Node.JS
package-lock.json
# Bundled relocatable ROOT + musrfit runtime (built by packaging/runtime)
runtime/*
!runtime/.gitkeep
# Generated local fit artifacts
/*_asy.msr
/*_asy.out
@@ -70,6 +74,7 @@ package-lock.json
# Sphinx build caches (the built HTML/PDF themselves are committed)
docs/_build/doctrees/
docs/_build/**/.doctrees/
docs/_build/html/.buildinfo
# Editors
+14
View File
@@ -71,6 +71,20 @@ release path documented in [`TODO.md`](TODO.md).
`musrfit` to write explicit `t0` lines from the histogram peak into the
generated MSR; the step is skipped automatically for LEM data.
### Bundled ROOT + musrfit runtime
- muSRFlow can now run against a relocatable ROOT + musrfit runtime shipped
inside the packaged app (`<resources>/runtime`) instead of a system-wide
installation. Local fits prefer the bundled tools over `/usr/local/bin`
(still yielding to a user-configured **musrfit binaries** directory) and
spawn them with `ROOTSYS`, `MUSRFITPATH`, `LD_LIBRARY_PATH`, and `PATH`
pointing at the bundle, so no separate musrfit install is required. When the
bundle is absent the previous host-installation behaviour is unchanged.
- The runtime is produced by `packaging/runtime/build.sh`, which builds ROOT
and musrfit in a low-glibc manylinux container, rewrites runpaths to
`$ORIGIN`-relative paths, and bundles the non-system shared-library closure.
The tree is git-ignored and shipped through the `extraResources` entry in
`package.json`.
## 1.0.0-rc.4 (2026-09-23)
### Parameter ordering
+12
View File
@@ -35,6 +35,18 @@ the command-line tools live.
- Share webpage links; **Restore configuration link** to paste one.
- Share button copies a link; opening it restores the settings.
Bundled ROOT and musrfit
------------------------
Packaged desktop builds can carry a self-contained ROOT + musrfit runtime
inside the application, so a separate musrfit installation is not required on
the machine. When the bundle is present muSRFlow runs those tools with
``ROOTSYS``, ``MUSRFITPATH``, and ``LD_LIBRARY_PATH`` pointed at the bundled
tree; a directory set in **Preferences / musrfit binaries** still takes
precedence, and on builds without the bundle the system installation is used
exactly as before. The runtime is built with ``packaging/runtime/build.sh``
(see ``packaging/runtime/README.md``).
The workflow chapters of this manual apply to both editions. Where a step is
specific to one edition (handling files, Preferences), the text says so
explicitly.
+15 -7
View File
@@ -22,13 +22,14 @@ musrfit startup XML
musrfit binaries
The directory that holds the musrfit tools (``musrfit``, ``musrview``,
``msr2data``, and ``dump_header``). Leave it empty for **auto-detect**
and muSRFlow searches the usual installation locations; choose a
directory when the tools live somewhere non-standard (for example a
developer build tree). The configured directory wins over every
auto-detected location for the tool commands muSRFlow runs, and is put
first on the ``PATH`` given to them. The setting is a desktop feature:
it is remembered across sessions, while the web edition takes its tools
from the server and never exposes this field.
and muSRFlow searches, in order, the bundled runtime shipped with the
packaged app, then the usual installation locations; choose a directory
when the tools live somewhere non-standard (for example a developer build
tree). The configured directory wins over every auto-detected location
for the tool commands muSRFlow runs, and is put first on the ``PATH``
given to them. The setting is a desktop feature: it is remembered across
sessions, while the web edition takes its tools from the server and never
exposes this field.
musrfit threads
The number of OpenMP threads passed to a local ``musrfit`` run (``-u``).
@@ -43,6 +44,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
+4 -1
View File
@@ -163,7 +163,10 @@ application (the <code class="docutils literal notranslate"><span class="pre">?<
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="preferences.html">Preferences</a></li>
<li class="toctree-l1"><a class="reference internal" href="platforms.html">Web and desktop editions</a></li>
<li class="toctree-l1"><a class="reference internal" href="platforms.html">Web and desktop editions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="platforms.html#bundled-root-and-musrfit">Bundled ROOT and musrfit</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="keyboard-shortcuts.html">Keyboard shortcuts</a><ul>
<li class="toctree-l2"><a class="reference internal" href="keyboard-shortcuts.html#parameter-selection-parameters-tab">Parameter selection (Parameters tab)</a></li>
<li class="toctree-l2"><a class="reference internal" href="keyboard-shortcuts.html#parameter-plot-window">Parameter-plot window</a></li>
+15 -1
View File
@@ -54,7 +54,10 @@
<li class="toctree-l1"><a class="reference internal" href="results-diagnostics.html">Results and diagnostics</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration-sharing.html">Configuration sharing</a></li>
<li class="toctree-l1"><a class="reference internal" href="preferences.html">Preferences</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Web and desktop editions</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Web and desktop editions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#bundled-root-and-musrfit">Bundled ROOT and musrfit</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="keyboard-shortcuts.html">Keyboard shortcuts</a></li>
<li class="toctree-l1"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
@@ -133,9 +136,20 @@ JSROOT in the page.</p></td>
</tr>
</tbody>
</table>
<section id="bundled-root-and-musrfit">
<h2>Bundled ROOT and musrfit<a class="headerlink" href="#bundled-root-and-musrfit" title="Link to this heading"></a></h2>
<p>Packaged desktop builds can carry a self-contained ROOT + musrfit runtime
inside the application, so a separate musrfit installation is not required on
the machine. When the bundle is present muSRFlow runs those tools with
<code class="docutils literal notranslate"><span class="pre">ROOTSYS</span></code>, <code class="docutils literal notranslate"><span class="pre">MUSRFITPATH</span></code>, and <code class="docutils literal notranslate"><span class="pre">LD_LIBRARY_PATH</span></code> pointed at the bundled
tree; a directory set in <strong>Preferences / musrfit binaries</strong> still takes
precedence, and on builds without the bundle the system installation is used
exactly as before. The runtime is built with <code class="docutils literal notranslate"><span class="pre">packaging/runtime/build.sh</span></code>
(see <code class="docutils literal notranslate"><span class="pre">packaging/runtime/README.md</span></code>).</p>
<p>The workflow chapters of this manual apply to both editions. Where a step is
specific to one edition (handling files, Preferences), the text says so
explicitly.</p>
</section>
</section>
+15 -8
View File
@@ -89,7 +89,7 @@
<p>The <strong>Preferences</strong> dialog is a desktop (Electron) feature: it opens from the
<strong>File</strong> menu. The web edition derives the same settings from server
configuration and never exposes this dialog.</p>
<dl class="simple">
<dl>
<dt>Work directory</dt><dd><p>Where generated files, MSR documents, and result artifacts are written.
Defaults to the current directory (<code class="docutils literal notranslate"><span class="pre">.</span></code>).</p>
</dd>
@@ -103,13 +103,14 @@ field shows the naming mode the detected XML enables.</p>
</dd>
<dt>musrfit binaries</dt><dd><p>The directory that holds the musrfit tools (<code class="docutils literal notranslate"><span class="pre">musrfit</span></code>, <code class="docutils literal notranslate"><span class="pre">musrview</span></code>,
<code class="docutils literal notranslate"><span class="pre">msr2data</span></code>, and <code class="docutils literal notranslate"><span class="pre">dump_header</span></code>). Leave it empty for <strong>auto-detect</strong>
and muSRFlow searches the usual installation locations; choose a
directory when the tools live somewhere non-standard (for example a
developer build tree). The configured directory wins over every
auto-detected location for the tool commands muSRFlow runs, and is put
first on the <code class="docutils literal notranslate"><span class="pre">PATH</span></code> given to them. The setting is a desktop feature:
it is remembered across sessions, while the web edition takes its tools
from the server and never exposes this field.</p>
and muSRFlow searches, in order, the bundled runtime shipped with the
packaged app, then the usual installation locations; choose a directory
when the tools live somewhere non-standard (for example a developer build
tree). The configured directory wins over every auto-detected location
for the tool commands muSRFlow runs, and is put first on the <code class="docutils literal notranslate"><span class="pre">PATH</span></code>
given to them. The setting is a desktop feature: it is remembered across
sessions, while the web edition takes its tools from the server and never
exposes this field.</p>
</dd>
<dt>musrfit threads</dt><dd><p>The number of OpenMP threads passed to a local <code class="docutils literal notranslate"><span class="pre">musrfit</span></code> run (<code class="docutils literal notranslate"><span class="pre">-u</span></code>).
Leave it blank to let musrfit use every available core. Set a lower
@@ -121,6 +122,12 @@ effect on the web edition, which runs fits on the server.</p>
a run set is added, muSRFlow reads the first run’s metadata to seed
sensible starting values (for example an approximate frequency or
asymmetry) instead of generic defaults.</p>
<p><strong>Estimate t0 from the prompt peak (non-LEM data)</strong> (on by default): before a
local fit, muSRFlow runs <code class="docutils literal notranslate"><span class="pre">musrt0</span> <span class="pre">--getT0FromPromptPeak</span></code> to write explicit
<code class="docutils literal notranslate"><span class="pre">t0</span></code> 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.</p>
</dd>
<dt>Output file suffixes</dt><dd><p>The suffixes appended to generated artifacts: <strong>Asymmetry</strong> (default
<code class="docutils literal notranslate"><span class="pre">_asy</span></code>) and <strong>Single histogram</strong> (default <code class="docutils literal notranslate"><span class="pre">_singleHist</span></code>). Change
+1 -1
View File
@@ -1 +1 @@
Search.setIndex({"alltitles":{"A first fit":[[7,"a-first-fit"]],"Command log":[[11,"command-log"]],"Configuration sharing":[[0,null]],"Constraints":[[1,null],[1,"id1"]],"Contents":[[4,null]],"Custom parameters":[[1,"custom-parameters"]],"Desktop installation":[[2,"desktop-installation"]],"Editing trace styles":[[8,"editing-trace-styles"]],"Example: couple the magnetic field to the Larmor frequency":[[1,"example-couple-the-magnetic-field-to-the-larmor-frequency"]],"Execution details":[[11,"execution-details"]],"File handling":[[6,"file-handling"]],"Fit and Plot":[[12,"fit-and-plot"]],"Fit model":[[12,"fit-model"]],"Fit options":[[12,"fit-options"]],"Fit or plot will not start":[[14,"fit-or-plot-will-not-start"]],"Fit range":[[12,"fit-range"]],"Fitted parameters look wrong or unchanged":[[14,"fitted-parameters-look-wrong-or-unchanged"]],"General notes":[[5,"general-notes"]],"Getting started":[[2,null]],"Glossary":[[3,null]],"Keyboard shortcuts":[[5,null],[8,"keyboard-shortcuts"]],"MSR editor":[[5,"msr-editor"],[6,null]],"Multi-group asymmetry fits":[[13,"multi-group-asymmetry-fits"]],"Notes":[[0,"notes"]],"On the desktop":[[0,"on-the-desktop"]],"On the web":[[0,"on-the-web"]],"Opening the web edition":[[2,"opening-the-web-edition"]],"Outcome dialog":[[11,"outcome-dialog"]],"Overlay data sets (multiple files in one panel)":[[8,"overlay-data-sets-multiple-files-in-one-panel"]],"Overview":[[7,null]],"Ownership: GUI or editor":[[6,"ownership-gui-or-editor"]],"Parameter plot hangs on \u201cPreparing plot files\u201d":[[14,"parameter-plot-hangs-on-preparing-plot-files"]],"Parameter plot is empty or missing data":[[14,"parameter-plot-is-empty-or-missing-data"]],"Parameter selection (Parameters tab)":[[5,"parameter-selection-parameters-tab"]],"Parameter-plot window":[[5,"parameter-plot-window"]],"Parameters and parameter plots":[[8,null]],"Per-run statistics":[[12,"per-run-statistics"]],"Plot options":[[8,"plot-options"]],"Preferences":[[10,null]],"Prerequisites":[[2,"prerequisites"]],"Preview":[[1,"preview"]],"Remembered plot configurations":[[8,"remembered-plot-configurations"]],"Reporting problems":[[14,"reporting-problems"]],"Restored configuration differs from the original machine":[[14,"restored-configuration-differs-from-the-original-machine"]],"Result files":[[11,"result-files"]],"Results and diagnostics":[[11,null]],"Run log window":[[11,"run-log-window"]],"Run selection":[[12,"run-selection"]],"Running the desktop app":[[2,"running-the-desktop-app"]],"Runs and fitting":[[12,null]],"Selecting parameters for plotting":[[8,"selecting-parameters-for-plotting"]],"Series fit actions":[[12,"series-fit-actions"]],"Some links start with a different prefix":[[14,"some-links-start-with-a-different-prefix"]],"Support":[[2,"support"]],"Template and series presets":[[8,"template-and-series-presets"]],"The Choose X axis dialog":[[8,"the-choose-x-axis-dialog"]],"The Quick Start guide":[[2,"the-quick-start-guide"]],"The Shared column":[[8,"the-shared-column"]],"The parameter table":[[8,"the-parameter-table"]],"The parameter-plot window":[[8,"the-parameter-plot-window"]],"The status bar":[[11,"the-status-bar"]],"Troubleshooting":[[14,null]],"Two editions":[[7,"two-editions"]],"Under the hood":[[7,"under-the-hood"]],"View settings":[[12,"view-settings"]],"Web and desktop editions":[[9,null]],"Web page cannot load data":[[14,"web-page-cannot-load-data"]],"What is shared":[[0,"what-is-shared"]],"What you get":[[7,"what-you-get"]],"Workflow":[[6,"workflow"]],"muSRFlow User Manual":[[4,null]],"t0 / background":[[13,null]],"\u201cNothing to fit\u201d":[[14,"nothing-to-fit"]]},"docnames":["configuration-sharing","constraints","getting-started","glossary","index","keyboard-shortcuts","msr-editor","overview","parameters-plots","platforms","preferences","results-diagnostics","runs-fitting","t0-background","troubleshooting"],"envversion":{"sphinx":65,"sphinx.domains.c":3,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":9,"sphinx.domains.index":1,"sphinx.domains.javascript":3,"sphinx.domains.math":2,"sphinx.domains.python":4,"sphinx.domains.rst":2,"sphinx.domains.std":2},"filenames":["configuration-sharing.rst","constraints.rst","getting-started.rst","glossary.rst","index.rst","keyboard-shortcuts.rst","msr-editor.rst","overview.rst","parameters-plots.rst","platforms.rst","preferences.rst","results-diagnostics.rst","runs-fitting.rst","t0-background.rst","troubleshooting.rst"],"indexentries":{},"objects":{},"objnames":{},"objtypes":{},"terms":{"":[0,3,5,6,8,10,12,13,14],"0":12,"01":12,"012":11,"1":[8,10,11,12,13],"100":[8,12],"101":13,"103":13,"12":[8,12],"16":12,"1998":12,"2":[8,12,13],"21":12,"24":12,"25":12,"3":[8,12,13],"300":8,"4":[12,13],"5":12,"514":[3,12],"515":[3,12],"516":12,"520":12,"525":12,"540":12,"7":12,"8":12,"A":[0,1,3,4,8,10,11,12,13,14],"For":[2,6,8,11,12,13],"If":[0,4,8,11,12,14],"In":[5,7,8,14],"It":[0,1,4,6,7,11],"Its":[5,7],"On":[2,3,4,6,7,9,11,12,14],"One":[3,12],"The":[0,1,3,4,5,6,7,9Line truncated
Search.setIndex({"alltitles":{"A first fit":[[7,"a-first-fit"]],"Bundled ROOT and musrfit":[[9,"bundled-root-and-musrfit"]],"Command log":[[11,"command-log"]],"Configuration sharing":[[0,null]],"Constraints":[[1,null],[1,"id1"]],"Contents":[[4,null]],"Custom parameters":[[1,"custom-parameters"]],"Desktop installation":[[2,"desktop-installation"]],"Editing trace styles":[[8,"editing-trace-styles"]],"Example: couple the magnetic field to the Larmor frequency":[[1,"example-couple-the-magnetic-field-to-the-larmor-frequency"]],"Execution details":[[11,"execution-details"]],"File handling":[[6,"file-handling"]],"Fit and Plot":[[12,"fit-and-plot"]],"Fit model":[[12,"fit-model"]],"Fit options":[[12,"fit-options"]],"Fit or plot will not start":[[14,"fit-or-plot-will-not-start"]],"Fit range":[[12,"fit-range"]],"Fitted parameters look wrong or unchanged":[[14,"fitted-parameters-look-wrong-or-unchanged"]],"General notes":[[5,"general-notes"]],"Getting started":[[2,null]],"Glossary":[[3,null]],"Keyboard shortcuts":[[5,null],[8,"keyboard-shortcuts"]],"MSR editor":[[5,"msr-editor"],[6,null]],"Multi-group asymmetry fits":[[13,"multi-group-asymmetry-fits"]],"Notes":[[0,"notes"]],"On the desktop":[[0,"on-the-desktop"]],"On the web":[[0,"on-the-web"]],"Opening the web edition":[[2,"opening-the-web-edition"]],"Outcome dialog":[[11,"outcome-dialog"]],"Overlay data sets (multiple files in one panel)":[[8,"overlay-data-sets-multiple-files-in-one-panel"]],"Overview":[[7,null]],"Ownership: GUI or editor":[[6,"ownership-gui-or-editor"]],"Parameter plot hangs on \u201cPreparing plot files\u201d":[[14,"parameter-plot-hangs-on-preparing-plot-files"]],"Parameter plot is empty or missing data":[[14,"parameter-plot-is-empty-or-missing-data"]],"Parameter selection (Parameters tab)":[[5,"parameter-selection-parameters-tab"]],"Parameter-plot window":[[5,"parameter-plot-window"]],"Parameters and parameter plots":[[8,null]],"Per-run statistics":[[12,"per-run-statistics"]],"Plot options":[[8,"plot-options"]],"Preferences":[[10,null]],"Prerequisites":[[2,"prerequisites"]],"Preview":[[1,"preview"]],"Remembered plot configurations":[[8,"remembered-plot-configurations"]],"Reporting problems":[[14,"reporting-problems"]],"Restored configuration differs from the original machine":[[14,"restored-configuration-differs-from-the-original-machine"]],"Result files":[[11,"result-files"]],"Results and diagnostics":[[11,null]],"Run log window":[[11,"run-log-window"]],"Run selection":[[12,"run-selection"]],"Running the desktop app":[[2,"running-the-desktop-app"]],"Runs and fitting":[[12,null]],"Selecting parameters for plotting":[[8,"selecting-parameters-for-plotting"]],"Series fit actions":[[12,"series-fit-actions"]],"Some links start with a different prefix":[[14,"some-links-start-with-a-different-prefix"]],"Support":[[2,"support"]],"Template and series presets":[[8,"template-and-series-presets"]],"The Choose X axis dialog":[[8,"the-choose-x-axis-dialog"]],"The Quick Start guide":[[2,"the-quick-start-guide"]],"The Shared column":[[8,"the-shared-column"]],"The parameter table":[[8,"the-parameter-table"]],"The parameter-plot window":[[8,"the-parameter-plot-window"]],"The status bar":[[11,"the-status-bar"]],"Troubleshooting":[[14,null]],"Two editions":[[7,"two-editions"]],"Under the hood":[[7,"under-the-hood"]],"View settings":[[12,"view-settings"]],"Web and desktop editions":[[9,null]],"Web page cannot load data":[[14,"web-page-cannot-load-data"]],"What is shared":[[0,"what-is-shared"]],"What you get":[[7,"what-you-get"]],"Workflow":[[6,"workflow"]],"muSRFlow User Manual":[[4,null]],"t0 / background":[[13,null]],"\u201cNothing to fit\u201d":[[14,"nothing-to-fit"]]},"docnames":["configuration-sharing","constraints","getting-started","glossary","index","keyboard-shortcuts","msr-editor","overview","parameters-plots","platforms","preferences","results-diagnostics","runs-fitting","t0-background","troubleshooting"],"envversion":{"sphinx":65,"sphinx.domains.c":3,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":9,"sphinx.domains.index":1,"sphinx.domains.javascript":3,"sphinx.domains.math":2,"sphinx.domains.python":4,"sphinx.domains.rst":2,"sphinx.domains.std":2},"filenames":["configuration-sharing.rst","constraints.rst","getting-started.rst","glossary.rst","index.rst","keyboard-shortcuts.rst","msr-editor.rst","overview.rst","parameters-plots.rst","platforms.rst","preferences.rst","results-diagnostics.rst","runs-fitting.rst","t0-background.rst","troubleshooting.rst"],"indexentries":{"addrun":[[3,"term-ADDRUN",true]],"configuration link":[[3,"term-configuration-link",true]],"dump_header":[[3,"term-dump_header",true]],"fft":[[3,"term-FFT",true]],"fit document":[[3,"term-fit-document",true]],"global parameter":[[3,"term-global-parameter",true]],"independent-series fit":[[3,"term-independent-series-fit",true]],"msr":[[3,"term-MSR",true]],"msr2data":[[3,"term-msr2data",true]],"musrfit":[[3,"term-musrfit",true]],"musrview":[[3,"term-musrview",truLine truncated
+2
View File
@@ -157,6 +157,8 @@
\@writefile{lot}{\addvspace {10\p@ }}
\newlabel{platforms:web-and-desktop-editions}{{11}{31}{Web and desktop editions}{chapter.11}{}}
\newlabel{platforms::doc}{{11}{31}{Web and desktop editions}{chapter.11}{}}
\@writefile{toc}{\contentsline {section}{\numberline {11.1}Bundled ROOT and musrfit}{31}{section.11.1}\protected@file@percent }
\newlabel{platforms:bundled-root-and-musrfit}{{11.1}{31}{Bundled ROOT and musrfit}{section.11.1}{}}
\@writefile{toc}{\contentsline {chapter}{\numberline {12}Keyboard shortcuts}{33}{chapter.12}\protected@file@percent }
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
+9 -9
View File
@@ -1,11 +1,11 @@
# Fdb version 4
["makeindex muSRFlow.idx"] 1791621490.17959 "muSRFlow.idx" "muSRFlow.ind" "muSRFlow" 1791621492.68928 0
"muSRFlow.idx" 1791621492.57293 1189 cca9fe93ffba026d593c5ed228d742a4 "pdflatex"
["makeindex muSRFlow.idx"] 1791621490.17959 "muSRFlow.idx" "muSRFlow.ind" "muSRFlow" 1791730106.16275 0
"muSRFlow.idx" 1791730106.04479 1189 cca9fe93ffba026d593c5ed228d742a4 "pdflatex"
(generated)
"muSRFlow.ilg"
"muSRFlow.ind"
(rewritten before read)
["pdflatex"] 1791621490.25453 "muSRFlow.tex" "muSRFlow.pdf" "muSRFlow" 1791621492.6894 0
["pdflatex"] 1791730103.78886 "muSRFlow.tex" "muSRFlow.pdf" "muSRFlow" 1791730106.16288 0
"/usr/share/texmf-dist/fonts/map/fontname/texfonts.map" 1577235249 3524 cb3e574dea2d1052e39280babc910dc8 ""
"/usr/share/texmf-dist/fonts/tfm/adobe/zapfding/pzdr.tfm" 1136768653 1528 f853c4d1b4e0550255e02831fdc8496f ""
"/usr/share/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex7.tfm" 1246382020 1004 54797486969f23fa377b128694d548df ""
@@ -119,13 +119,13 @@
"/usr/share/texmf-dist/tex/latex/xcolor/xcolor.sty" 1727642399 55384 b454dec21c2d9f45ec0b793f0995b992 ""
"/usr/share/texmf-dist/web2c/texmf.cnf" 1772498184 43617 0f84662189cad3132fecd51f17dd9276 ""
"/var/lib/texmf/web2c/xetex/xelatex.fmt" 1783332064 6760887 1c6d1ad838ac2a3dddf7a0433c780710 ""
"muSRFlow.aux" 1791621492.57093 24094 b9641ed569624ace42786c1a19c9abb9 "pdflatex"
"muSRFlow.aux" 1791730106.04279 24322 9176e2a8d1447fe1bc48c56f4059a194 "pdflatex"
"muSRFlow.ind" 1791621490.25033 1435 1ea9e98c4c43945295d6873d01cf2032 "makeindex muSRFlow.idx"
"muSRFlow.out" 1791621492.57293 11693 68c631c84176186f2178a7a81175bf94 "pdflatex"
"muSRFlow.tex" 1791621487.58409 81175 1a7462f4e771ce8d5723409ab1ef1caa ""
"muSRFlow.toc" 1791621492.57293 6146 1a3955ffa5b979e4c4a53a6e506c02eb "pdflatex"
"muSRFlow.out" 1791730106.04479 11879 c29038db42596b165f0732dea8edf516 "pdflatex"
"muSRFlow.tex" 1791730092.72346 82633 31a973eb060f51d752bbd1915b2056e9 ""
"muSRFlow.toc" 1791730106.04479 6233 a8f6b0c136864b1af14f888e6e6bff3e "pdflatex"
"sphinx.sty" 1789374174.58095 54203 ee7fe875437470f5328ee20661bb9f1d ""
"sphinxhighlight.sty" 1791621487.45696 7553 83fb52292c17957d9f4aadcb28c57a87 ""
"sphinxhighlight.sty" 1791730092.60905 7553 83fb52292c17957d9f4aadcb28c57a87 ""
"sphinxlatexadmonitions.sty" 1789374174.58095 19111 5e67a0f91439018bceb7cadf319345e6 ""
"sphinxlatexcontainers.sty" 1789374174.58295 900 d61f923db071a7b54d3cee8a1e6935d3 ""
"sphinxlatexgraphics.sty" 1789374174.58295 4918 c9266041d02bc615d54b890e96e3acd3 ""
@@ -140,7 +140,7 @@
"sphinxlatexstyletext.sty" 1789374174.58495 6759 9e932c65374cfb62686485d331bc975c ""
"sphinxlatextables.sty" 1789374174.58495 57643 7f1013c2fa11942370d867527bdda568 ""
"sphinxmanual.cls" 1789374174.58495 4241 7b0d7a37df7b5715fb0dbd585c52ecdb ""
"sphinxmessages.sty" 1791621487.5879 745 3f5fcd6cdd7964ed608767954a8ced6f ""
"sphinxmessages.sty" 1791730092.72877 745 3f5fcd6cdd7964ed608767954a8ced6f ""
"sphinxoptionsgeometry.sty" 1789374174.58695 2060 6c27b3eba37bde592ae8908ab2c1ac0f ""
"sphinxoptionshyperref.sty" 1789374174.58695 1093 e468489bae7631a7f387b4b0f7bc15d4 ""
"sphinxpackageboxes.sty" 1789374174.58695 36106 1be2053eb1cb9b083b3a75e3657bcb24 ""
+18 -17
View File
@@ -56,20 +56,21 @@
\BOOKMARK [1][-]{section.9.4}{\376\377\000N\000o\000t\000e\000s}{chapter.9}% 56
\BOOKMARK [0][-]{chapter.10}{\376\377\000P\000r\000e\000f\000e\000r\000e\000n\000c\000e\000s}{}% 57
\BOOKMARK [0][-]{chapter.11}{\376\377\000W\000e\000b\000\040\000a\000n\000d\000\040\000d\000e\000s\000k\000t\000o\000p\000\040\000e\000d\000i\000t\000i\000o\000n\000s}{}% 58
\BOOKMARK [0][-]{chapter.12}{\376\377\000K\000e\000y\000b\000o\000a\000r\000d\000\040\000s\000h\000o\000r\000t\000c\000u\000t\000s}{}% 59
\BOOKMARK [1][-]{section.12.1}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000\040\000s\000e\000l\000e\000c\000t\000i\000o\000n\000\040\000\050\000P\000a\000r\000a\000m\000e\000t\000e\000r\000s\000\040\000t\000a\000b\000\051}{chapter.12}% 60
\BOOKMARK [1][-]{section.12.2}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000-\000p\000l\000o\000t\000\040\000w\000i\000n\000d\000o\000w}{chapter.12}% 61
\BOOKMARK [1][-]{section.12.3}{\376\377\000M\000S\000R\000\040\000e\000d\000i\000t\000o\000r}{chapter.12}% 62
\BOOKMARK [1][-]{section.12.4}{\376\377\000G\000e\000n\000e\000r\000a\000l\000\040\000n\000o\000t\000e\000s}{chapter.12}% 63
\BOOKMARK [0][-]{chapter.13}{\376\377\000T\000r\000o\000u\000b\000l\000e\000s\000h\000o\000o\000t\000i\000n\000g}{}% 64
\BOOKMARK [1][-]{section.13.1}{\376\377\000F\000i\000t\000\040\000o\000r\000\040\000p\000l\000o\000t\000\040\000w\000i\000l\000l\000\040\000n\000o\000t\000\040\000s\000t\000a\000r\000t}{chapter.13}% 65
\BOOKMARK [1][-]{section.13.2}{\376\377\040\034\000N\000o\000t\000h\000i\000n\000g\000\040\000t\000o\000\040\000f\000i\000t\040\035}{chapter.13}% 66
\BOOKMARK [1][-]{section.13.3}{\376\377\000F\000i\000t\000t\000e\000d\000\040\000p\000a\000r\000a\000m\000e\000t\000e\000r\000s\000\040\000l\000o\000o\000k\000\040\000w\000r\000o\000n\000g\000\040\000o\000r\000\040\000u\000n\000c\000h\000a\000n\000g\000e\000d}{chapter.13}% 67
\BOOKMARK [1][-]{section.13.4}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000\040\000p\000l\000o\000t\000\040\000i\000s\000\040\000e\000m\000p\000t\000y\000\040\000o\000r\000\040\000m\000i\000s\000s\000i\000n\000g\000\040\000d\000a\000t\000a}{chapter.13}% 68
\BOOKMARK [1][-]{section.13.5}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000\040\000p\000l\000o\000t\000\040\000h\000a\000n\000g\000s\000\040\000o\000n\000\040\040\034\000P\000r\000e\000p\000a\000r\000i\000n\000g\000\040\000p\000l\000o\000t\000\040\000f\000i\000l\000e\000s\040\035}{chapter.13}% 69
\BOOKMARK [1][-]{section.13.6}{\376\377\000W\000e\000b\000\040\000p\000a\000g\000e\000\040\000c\000a\000n\000n\000o\000t\000\040\000l\000o\000a\000d\000\040\000d\000a\000t\000a}{chapter.13}% 70
\BOOKMARK [1][-]{section.13.7}{\376\377\000R\000e\000s\000t\000o\000r\000e\000d\000\040\000c\000o\000n\000f\000i\000g\000u\000r\000a\000t\000i\000o\000n\000\040\000d\000i\000f\000f\000e\000r\000s\000\040\000f\000r\000o\000m\000\040\000t\000h\000e\000\040\000o\000r\000i\000g\000i\000n\000a\000l\000\040\000m\000a\000c\000h\000i\000n\000e}{chapter.13}% 71
\BOOKMARK [1][-]{section.13.8}{\376\377\000S\000o\000m\000e\000\040\000l\000i\000n\000k\000s\000\040\000s\000t\000a\000r\000t\000\040\000w\000i\000t\000h\000\040\000a\000\040\000d\000i\000f\000f\000e\000r\000e\000n\000t\000\040\000p\000r\000e\000f\000i\000x}{chapter.13}% 72
\BOOKMARK [1][-]{section.13.9}{\376\377\000R\000e\000p\000o\000r\000t\000i\000n\000g\000\040\000p\000r\000o\000b\000l\000e\000m\000s}{chapter.13}% 73
\BOOKMARK [0][-]{chapter.14}{\376\377\000G\000l\000o\000s\000s\000a\000r\000y}{}% 74
\BOOKMARK [0][-]{section*.18}{\376\377\000I\000n\000d\000e\000x}{}% 75
\BOOKMARK [1][-]{section.11.1}{\376\377\000B\000u\000n\000d\000l\000e\000d\000\040\000R\000O\000O\000T\000\040\000a\000n\000d\000\040\000m\000u\000s\000r\000f\000i\000t}{chapter.11}% 59
\BOOKMARK [0][-]{chapter.12}{\376\377\000K\000e\000y\000b\000o\000a\000r\000d\000\040\000s\000h\000o\000r\000t\000c\000u\000t\000s}{}% 60
\BOOKMARK [1][-]{section.12.1}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000\040\000s\000e\000l\000e\000c\000t\000i\000o\000n\000\040\000\050\000P\000a\000r\000a\000m\000e\000t\000e\000r\000s\000\040\000t\000a\000b\000\051}{chapter.12}% 61
\BOOKMARK [1][-]{section.12.2}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000-\000p\000l\000o\000t\000\040\000w\000i\000n\000d\000o\000w}{chapter.12}% 62
\BOOKMARK [1][-]{section.12.3}{\376\377\000M\000S\000R\000\040\000e\000d\000i\000t\000o\000r}{chapter.12}% 63
\BOOKMARK [1][-]{section.12.4}{\376\377\000G\000e\000n\000e\000r\000a\000l\000\040\000n\000o\000t\000e\000s}{chapter.12}% 64
\BOOKMARK [0][-]{chapter.13}{\376\377\000T\000r\000o\000u\000b\000l\000e\000s\000h\000o\000o\000t\000i\000n\000g}{}% 65
\BOOKMARK [1][-]{section.13.1}{\376\377\000F\000i\000t\000\040\000o\000r\000\040\000p\000l\000o\000t\000\040\000w\000i\000l\000l\000\040\000n\000o\000t\000\040\000s\000t\000a\000r\000t}{chapter.13}% 66
\BOOKMARK [1][-]{section.13.2}{\376\377\040\034\000N\000o\000t\000h\000i\000n\000g\000\040\000t\000o\000\040\000f\000i\000t\040\035}{chapter.13}% 67
\BOOKMARK [1][-]{section.13.3}{\376\377\000F\000i\000t\000t\000e\000d\000\040\000p\000a\000r\000a\000m\000e\000t\000e\000r\000s\000\040\000l\000o\000o\000k\000\040\000w\000r\000o\000n\000g\000\040\000o\000r\000\040\000u\000n\000c\000h\000a\000n\000g\000e\000d}{chapter.13}% 68
\BOOKMARK [1][-]{section.13.4}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000\040\000p\000l\000o\000t\000\040\000i\000s\000\040\000e\000m\000p\000t\000y\000\040\000o\000r\000\040\000m\000i\000s\000s\000i\000n\000g\000\040\000d\000a\000t\000a}{chapter.13}% 69
\BOOKMARK [1][-]{section.13.5}{\376\377\000P\000a\000r\000a\000m\000e\000t\000e\000r\000\040\000p\000l\000o\000t\000\040\000h\000a\000n\000g\000s\000\040\000o\000n\000\040\040\034\000P\000r\000e\000p\000a\000r\000i\000n\000g\000\040\000p\000l\000o\000t\000\040\000f\000i\000l\000e\000s\040\035}{chapter.13}% 70
\BOOKMARK [1][-]{section.13.6}{\376\377\000W\000e\000b\000\040\000p\000a\000g\000e\000\040\000c\000a\000n\000n\000o\000t\000\040\000l\000o\000a\000d\000\040\000d\000a\000t\000a}{chapter.13}% 71
\BOOKMARK [1][-]{section.13.7}{\376\377\000R\000e\000s\000t\000o\000r\000e\000d\000\040\000c\000o\000n\000f\000i\000g\000u\000r\000a\000t\000i\000o\000n\000\040\000d\000i\000f\000f\000e\000r\000s\000\040\000f\000r\000o\000m\000\040\000t\000h\000e\000\040\000o\000r\000i\000g\000i\000n\000a\000l\000\040\000m\000a\000c\000h\000i\000n\000e}{chapter.13}% 72
\BOOKMARK [1][-]{section.13.8}{\376\377\000S\000o\000m\000e\000\040\000l\000i\000n\000k\000s\000\040\000s\000t\000a\000r\000t\000\040\000w\000i\000t\000h\000\040\000a\000\040\000d\000i\000f\000f\000e\000r\000e\000n\000t\000\040\000p\000r\000e\000f\000i\000x}{chapter.13}% 73
\BOOKMARK [1][-]{section.13.9}{\376\377\000R\000e\000p\000o\000r\000t\000i\000n\000g\000\040\000p\000r\000o\000b\000l\000e\000m\000s}{chapter.13}% 74
\BOOKMARK [0][-]{chapter.14}{\376\377\000G\000l\000o\000s\000s\000a\000r\000y}{}% 75
\BOOKMARK [0][-]{section*.18}{\376\377\000I\000n\000d\000e\000x}{}% 76
BIN
View File
Binary file not shown.
+30 -8
View File
@@ -71,7 +71,7 @@
\title{muSRFlow User Manual}
\date{Oct 10, 2026}
\date{Oct 11, 2026}
\release{1.0.0\sphinxhyphen{}rc.4}
\author{Zaher Salman}
\newcommand{\sphinxlogo}{\vbox{}}
@@ -1613,13 +1613,14 @@ field shows the naming mode the detected XML enables.
\sphinxAtStartPar
The directory that holds the musrfit tools (\sphinxcode{\sphinxupquote{musrfit}}, \sphinxcode{\sphinxupquote{musrview}},
\sphinxcode{\sphinxupquote{msr2data}}, and \sphinxcode{\sphinxupquote{dump\_header}}). Leave it empty for \sphinxstylestrong{auto\sphinxhyphen{}detect}
and muSRFlow searches the usual installation locations; choose a
directory when the tools live somewhere non\sphinxhyphen{}standard (for example a
developer build tree). The configured directory wins over every
auto\sphinxhyphen{}detected location for the tool commands muSRFlow runs, and is put
first on the \sphinxcode{\sphinxupquote{PATH}} given to them. The setting is a desktop feature:
it is remembered across sessions, while the web edition takes its tools
from the server and never exposes this field.
and muSRFlow searches, in order, the bundled runtime shipped with the
packaged app, then the usual installation locations; choose a directory
when the tools live somewhere non\sphinxhyphen{}standard (for example a developer build
tree). The configured directory wins over every auto\sphinxhyphen{}detected location
for the tool commands muSRFlow runs, and is put first on the \sphinxcode{\sphinxupquote{PATH}}
given to them. The setting is a desktop feature: it is remembered across
sessions, while the web edition takes its tools from the server and never
exposes this field.
\sphinxlineitem{musrfit threads}
\sphinxAtStartPar
@@ -1636,6 +1637,14 @@ a run set is added, muSRFlow reads the first run’s metadata to seed
sensible starting values (for example an approximate frequency or
asymmetry) instead of generic defaults.
\sphinxAtStartPar
\sphinxstylestrong{Estimate t0 from the prompt peak (non\sphinxhyphen{}LEM data)} (on by default): before a
local fit, muSRFlow runs \sphinxcode{\sphinxupquote{musrt0 \sphinxhyphen{}\sphinxhyphen{}getT0FromPromptPeak}} to write explicit
\sphinxcode{\sphinxupquote{t0}} lines into the generated MSR. This forces musrfit to use the
histogram peak as the time\sphinxhyphen{}zero for instruments whose data\sphinxhyphen{}file header t0 is
unreliable; the step is skipped automatically for LEM data. Uncheck it to
preserve the MSR as generated.
\sphinxlineitem{Output file suffixes}
\sphinxAtStartPar
The suffixes appended to generated artifacts: \sphinxstylestrong{Asymmetry} (default
@@ -1753,6 +1762,19 @@ Share button copies a link; opening it restores the settings.
\sphinxtableafterendhook\par
\sphinxattableend\end{savenotes}
\section{Bundled ROOT and musrfit}
\label{\detokenize{platforms:bundled-root-and-musrfit}}
\sphinxAtStartPar
Packaged desktop builds can carry a self\sphinxhyphen{}contained ROOT + musrfit runtime
inside the application, so a separate musrfit installation is not required on
the machine. When the bundle is present muSRFlow runs those tools with
\sphinxcode{\sphinxupquote{ROOTSYS}}, \sphinxcode{\sphinxupquote{MUSRFITPATH}}, and \sphinxcode{\sphinxupquote{LD\_LIBRARY\_PATH}} pointed at the bundled
tree; a directory set in \sphinxstylestrong{Preferences / musrfit binaries} still takes
precedence, and on builds without the bundle the system installation is used
exactly as before. The runtime is built with \sphinxcode{\sphinxupquote{packaging/runtime/build.sh}}
(see \sphinxcode{\sphinxupquote{packaging/runtime/README.md}}).
\sphinxAtStartPar
The workflow chapters of this manual apply to both editions. Where a step is
specific to one edition (handling files, Preferences), the text says so
+1
View File
@@ -57,6 +57,7 @@
\contentsline {section}{\numberline {9.4}Notes}{28}{section.9.4}%
\contentsline {chapter}{\numberline {10}Preferences}{29}{chapter.10}%
\contentsline {chapter}{\numberline {11}Web and desktop editions}{31}{chapter.11}%
\contentsline {section}{\numberline {11.1}Bundled ROOT and musrfit}{31}{section.11.1}%
\contentsline {chapter}{\numberline {12}Keyboard shortcuts}{33}{chapter.12}%
\contentsline {section}{\numberline {12.1}Parameter selection (Parameters tab)}{33}{section.12.1}%
\contentsline {section}{\numberline {12.2}Parameter\sphinxhyphen {}plot window}{33}{section.12.2}%
+12
View File
@@ -35,6 +35,18 @@ the command-line tools live.
- Share webpage links; **Restore configuration link** to paste one.
- Share button copies a link; opening it restores the settings.
Bundled ROOT and musrfit
------------------------
Packaged desktop builds can carry a self-contained ROOT + musrfit runtime
inside the application, so a separate musrfit installation is not required on
the machine. When the bundle is present muSRFlow runs those tools with
``ROOTSYS``, ``MUSRFITPATH``, and ``LD_LIBRARY_PATH`` pointed at the bundled
tree; a directory set in **Preferences / musrfit binaries** still takes
precedence, and on builds without the bundle the system installation is used
exactly as before. The runtime is built with ``packaging/runtime/build.sh``
(see ``packaging/runtime/README.md``).
The workflow chapters of this manual apply to both editions. Where a step is
specific to one edition (handling files, Preferences), the text says so
explicitly.
+8 -7
View File
@@ -22,13 +22,14 @@ musrfit startup XML
musrfit binaries
The directory that holds the musrfit tools (``musrfit``, ``musrview``,
``msr2data``, and ``dump_header``). Leave it empty for **auto-detect**
and muSRFlow searches the usual installation locations; choose a
directory when the tools live somewhere non-standard (for example a
developer build tree). The configured directory wins over every
auto-detected location for the tool commands muSRFlow runs, and is put
first on the ``PATH`` given to them. The setting is a desktop feature:
it is remembered across sessions, while the web edition takes its tools
from the server and never exposes this field.
and muSRFlow searches, in order, the bundled runtime shipped with the
packaged app, then the usual installation locations; choose a directory
when the tools live somewhere non-standard (for example a developer build
tree). The configured directory wins over every auto-detected location
for the tool commands muSRFlow runs, and is put first on the ``PATH``
given to them. The setting is a desktop feature: it is remembered across
sessions, while the web edition takes its tools from the server and never
exposes this field.
musrfit threads
The number of OpenMP threads passed to a local ``musrfit`` run (``-u``).
+66 -14
View File
@@ -751,8 +751,7 @@ function selectBinFolder() {
function loadRunHeaderText(filePath, fileFormat) {
let dumpHeader = resolveLocalCommand("dump_header");
let env = Object.assign({}, nodeProcess.env);
env.PATH = localCommandPathBias();
let env = buildToolEnvironment();
let args = ["-fn", filePath];
if (fileFormat) args.push("-ff", fileFormat);
let result = nodeChildProcess.spawnSync(dumpHeader, args, {
@@ -897,7 +896,7 @@ function executeCapture(command, cwd = undefined, envOverrides = {}) {
try {
const stdout = nodeChildProcess.execSync(command, {
cwd: cwd,
env: Object.assign({}, nodeProcess.env, envOverrides || {}),
env: Object.assign(buildToolEnvironment(), envOverrides || {}),
stdio: ['ignore', 'pipe', 'pipe'],
encoding: 'utf8'
});
@@ -1023,6 +1022,46 @@ function fileExists(filename) {
return 0;
}
// A relocatable ROOT + musrfit runtime can be shipped inside the packaged app
// (built by packaging/runtime and installed under <resources>/runtime). It is
// detected only when a musrfit executable is actually present, so development
// checkouts, web builds, and packages without the bundle fall back to the host
// installation unchanged.
function bundledRuntimeRoot() {
if (!nodeProcess || !nodeProcess.resourcesPath) return "";
let root = nodePath.join(nodeProcess.resourcesPath, "runtime");
if (fileExists(nodePath.join(root, "bin", "musrfit"))
|| fileExists(nodePath.join(root, "bin", "musrt0"))) {
return root;
}
return "";
}
function bundledRuntimeBinDir() {
let root = bundledRuntimeRoot();
return root === "" ? "" : nodePath.join(root, "bin");
}
// Environment for externally spawned musrfit tools. When the bundled runtime is
// present, point ROOTSYS/MUSRFITPATH at it and prepend its lib directory so the
// binaries load the bundled ROOT and musrfit shared libraries regardless of the
// host; otherwise the host environment is passed through with the usual PATH
// bias for the configured and PSI/local tool locations.
function buildToolEnvironment() {
let env = Object.assign({}, nodeProcess.env);
let root = bundledRuntimeRoot();
if (root !== "") {
let libDir = nodePath.join(root, "lib");
env.ROOTSYS = root;
env.MUSRFITPATH = root;
env.LD_LIBRARY_PATH = env.LD_LIBRARY_PATH
? libDir + ":" + env.LD_LIBRARY_PATH
: libDir;
}
env.PATH = localCommandPathBias();
return env;
}
function resolveLocalCommand(commandName) {
let candidates = [];
let configuredBinDir = typeof getConfiguredBinDir === "function"
@@ -1032,6 +1071,12 @@ function resolveLocalCommand(commandName) {
// location, since auto-detection does not always find an installation.
candidates.push(nodePath.join(configuredBinDir, commandName));
}
let bundledBinDir = bundledRuntimeBinDir();
if (bundledBinDir !== "") {
// The bundled runtime outranks the host installation but still yields to
// an explicit user-configured tools directory.
candidates.push(nodePath.join(bundledBinDir, commandName));
}
candidates = candidates.concat([
"/usr/local/bin/" + commandName,
"/usr/bin/" + commandName
@@ -1048,11 +1093,16 @@ function resolveLocalCommand(commandName) {
return commandName;
}
// Path bias applied to externally spawned tools. The configured musrfit-tool
// directory, when present, is placed ahead of the usual PSI/local locations so
// children of musrfit that resolve their own helpers follow the preference.
// Path bias applied to externally spawned tools. The bundled runtime and the
// configured musrfit-tool directory, when present, are placed ahead of the
// usual PSI/local locations so children of musrfit that resolve their own
// helpers follow the preference.
function localCommandPathBias() {
let dirs = ["/usr/local/bin", "/usr/bin", "/bin"];
let bundledBinDir = bundledRuntimeBinDir();
if (bundledBinDir !== "") {
dirs.unshift(bundledBinDir);
}
let configuredBinDir = typeof getConfiguredBinDir === "function"
? getConfiguredBinDir() : "";
if (configuredBinDir !== "") {
@@ -1112,10 +1162,9 @@ function runLocalProcess(label, command, args, cwd, logFile, options = {}) {
}
appendFitLog(logFile, "\n$ " + commandLine + "\n");
// Preserve the user's environment but bias PATH toward the configured and
// PSI/local locations where musrfit installations usually live.
let env = Object.assign({}, nodeProcess.env);
env.PATH = localCommandPathBias();
// Preserve the user's environment but bias PATH toward the bundled,
// configured, and PSI/local locations where musrfit installations live.
let env = buildToolEnvironment();
// In the hardened build child_process access lives behind the preload
// bridge, which buffers the streams and invokes onChunk per chunk so the
@@ -1441,8 +1490,7 @@ async function collectIndependentSeriesArtifactsLocal(spec) {
let runsArg = "[" + prepared.runs.join(" ") + "]";
let msr2data = resolveLocalCommand("msr2data");
let env = Object.assign({}, nodeProcess.env);
env.PATH = ["/usr/local/bin", "/usr/bin", "/bin", env.PATH || ""].join(":");
let env = buildToolEnvironment();
let runMsr2data = function(label, args) {
let commandLine = displayCommand(msr2data, args);
appendFitLog(logPath, "\n$ " + commandLine + "\n");
@@ -1576,8 +1624,7 @@ function exportLocalMusrfitParameterData(resolvedPath, options, logFile) {
appendJobLog("Starting msr2data parameter export: " + commandLine);
}
let env = Object.assign({}, nodeProcess.env);
env.PATH = ["/usr/local/bin", "/usr/bin", "/bin", env.PATH || ""].join(":");
let env = buildToolEnvironment();
let result = nodeChildProcess.spawnSync(msr2data, args, {
cwd: fitDir,
env: env,
@@ -1836,6 +1883,11 @@ function loadLocalPortableRunNaming() {
let home = nodeProcess.env.HOME || "";
if (home) candidates.push(nodePath.join(home, ".musrfit", "musrfit_startup.xml"));
candidates.push(nodePath.join(nodeProcess.cwd(), "musrfit_startup.xml"));
let bundledRoot = bundledRuntimeRoot();
if (bundledRoot !== "") {
// Final fallback: the startup XML shipped alongside the bundled runtime.
candidates.push(nodePath.join(bundledRoot, "musrfit_startup.xml"));
}
for (let i = 0; i < candidates.length; i++) {
if (nodeFs.existsSync(candidates[i])) {
startupPath = candidates[i];
+10 -1
View File
@@ -13,7 +13,7 @@
"checksums:md5": "sh -c 'd=dist; [ -d \"$d\" ] || exit 0; for f in \"$d\"/*; do [ -f \"$f\" ] || continue; case \"$f\" in *.rpm|*.AppImage) base=$(basename \"$f\"); (cd \"$d\" && md5sum \"$base\" > \"$base.md5\");; esac; done'",
"checksums:sha256": "sh -c 'd=dist; [ -d \"$d\" ] || exit 0; for f in \"$d\"/*; do [ -f \"$f\" ] || continue; case \"$f\" in *.rpm|*.AppImage) base=$(basename \"$f\"); (cd \"$d\" && sha256sum \"$base\" > \"$base.sha256\");; esac; done'",
"checksums": "npm run checksums:md5 && npm run checksums:sha256",
"test:electron": "node tests/log-highlighting.test.js && node tests/action-state.test.js && node tests/electron-missing-data.test.js && node tests/electron-msr-title.test.js && node tests/electron-musrfit-threads.test.js && node tests/window-layering.test.js && node tests/msr-generation.test.js && node tests/root-plot-clean.test.js && node tests/parameter-plot.test.js && node tests/help-window.test.js && node tests/release-packaging.test.js && node tests/addrun.test.js && node tests/fit-statistic.test.js && node tests/series-fit-planner.test.js && node tests/series-fit-result.test.js && node tests/series-fit-inventory.test.js && node tests/series-fit-msr-preparation.test.js && node tests/series-artifact-contract.test.js && node tests/series-global-merge.test.js && node tests/series-fit-staging.test.js && node tests/series-fit-runner.test.js && node tests/series-runner-adapters.test.js && node tests/series-fit-routing.test.js && node tests/series-action-chips.test.js && node tests/singlehist-parity.test.js && node tests/url-parameters.test.js && node tests/run-naming.test.js && node tests/electron-portable-naming.test.js && node tests/shared-configuration.test.js && node tests/session-persistence.test.js && node tests/reference-fixtures.test.js && node tests/electron-bridge.test.js"
"test:electron": "node tests/log-highlighting.test.js && node tests/action-state.test.js && node tests/electron-missing-data.test.js && node tests/electron-msr-title.test.js && node tests/electron-musrfit-threads.test.js && node tests/window-layering.test.js && node tests/msr-generation.test.js && node tests/root-plot-clean.test.js && node tests/parameter-plot.test.js && node tests/help-window.test.js && node tests/release-packaging.test.js && node tests/addrun.test.js && node tests/fit-statistic.test.js && node tests/series-fit-planner.test.js && node tests/series-fit-result.test.js && node tests/series-fit-inventory.test.js && node tests/series-fit-msr-preparation.test.js && node tests/series-artifact-contract.test.js && node tests/series-global-merge.test.js && node tests/series-fit-staging.test.js && node tests/series-fit-runner.test.js && node tests/series-runner-adapters.test.js && node tests/series-fit-routing.test.js && node tests/series-action-chips.test.js && node tests/singlehist-parity.test.js && node tests/url-parameters.test.js && node tests/run-naming.test.js && node tests/electron-portable-naming.test.js && node tests/shared-configuration.test.js && node tests/session-persistence.test.js && node tests/reference-fixtures.test.js && node tests/electron-bridge.test.js && node tests/electron-bundled-runtime.test.js"
},
"repository": {
"type": "git",
@@ -61,6 +61,15 @@
"directories": {
"output": "dist"
},
"extraResources": [
{
"from": "runtime",
"to": "runtime",
"filter": [
"**/*"
]
}
],
"protocols": [
{
"name": "muSRFlow configuration link",
+53
View File
@@ -0,0 +1,53 @@
# Copyright (C) 2026 Zaher Salman
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Build container for the relocatable ROOT + musrfit runtime bundled with
# muSRFlow. The default base is a manylinux_2_28 image (AlmaLinux 8, glibc
# 2.28): it has a C++17 toolchain and gives a low glibc floor for the AppImage.
# Override BASE_IMAGE to target a different baseline (for example a custom
# manylinux2014 + devtoolset image), but note ROOT 6.38 will not build with the
# stock CentOS 7 GCC 4.8.
ARG BASE_IMAGE=quay.io/pypa/manylinux_2_28_x86_64
FROM ${BASE_IMAGE}
ARG DEPS=""
RUN dnf -y install \
cmake \
gcc \
gcc-c++ \
make \
wget \
git \
which \
tar \
gzip \
patchelf \
gsl-devel \
fftw-devel \
libxml2-devel \
boost-devel \
openssl-devel \
pcre-devel \
zlib-devel \
xz-devel \
freetype-devel \
fontconfig-devel \
libpng-devel \
libjpeg-turbo-devel \
libtiff-devel \
mesa-libGL-devel \
mesa-libGLU-devel \
libX11-devel \
libXext-devel \
libXft-devel \
libXpm-devel \
libXcursor-devel \
libXrandr-devel \
libXi-devel \
python3 \
&& dnf clean all
WORKDIR /work
ENTRYPOINT ["/work/packaging/runtime/build-runtime.sh"]
+91
View File
@@ -0,0 +1,91 @@
# Bundled ROOT + musrfit runtime
muSRFlow can ship a self-contained, relocatable ROOT + musrfit runtime so users
do not need a system-wide musrfit installation. The tree is built once in a
low-glibc container and placed at `<app resources>/runtime`, where the renderer
discovers it automatically (see `muSRFitelec.js::bundledRuntimeRoot`).
## Layout
The runtime is a single install prefix that doubles as `ROOTSYS`:
```
runtime/
bin/ # root-config, musrfit, musrt0, musrview, msr2data, ...
lib/ # libCore.so…, libPMusr.so…, bundled third-party .so
include/
etc/ # ROOT/system config
share/
musrfit_startup.xml # default startup file found via MUSRFITPATH
```
ROOT is configured with `-Dgnuinstall=OFF` so its libraries land in `lib/`
alongside `libPMusr`, letting a single `LD_LIBRARY_PATH` entry cover both.
Qt-based tools are disabled (`-Dqt_based_tools=OFF`) because muSRFlow only needs
the command-line tools.
## Environment contract
`muSRFitelec.js::buildToolEnvironment` exports, for every spawned musrfit tool:
| Variable | Value |
|-------------------|---------------------------------------------------|
| `ROOTSYS` | `<runtime>` |
| `MUSRFITPATH` | `<runtime>` (musrfit finds `<runtime>/musrfit_startup.xml`) |
| `LD_LIBRARY_PATH` | `<runtime>/lib` prepended to the host value |
| `PATH` | `<runtime>/bin` prepended (after a user-configured tools dir) |
Resolution order for a tool (`resolveLocalCommand`):
1. user-configured tools directory (Preferences → musrfit binaries)
2. `<resources>/runtime/bin`
3. `/usr/local/bin`, `/usr/bin`
4. `<resources>/bin`, `<resources>`
5. current working directory
If `<resources>/runtime/bin/musrfit` (or `musrt0`) is absent, the bundle is
considered unavailable and the host installation is used unchanged. This keeps
development checkouts and web builds working with no configuration.
## Building
Requires Docker or Podman.
```sh
packaging/runtime/build.sh
```
The host wrapper builds the image from `Dockerfile` and runs `build-runtime.sh`,
which downloads and builds ROOT, builds musrfit against it, bundles the
non-system shared-library closure, and writes the result to `<repo>/runtime`.
`electron-builder` then ships it via the `extraResources` entry in
`package.json`, and `dist:linux` produces an AppImage/RPM with the runtime
inside.
Overridable variables (environment or `build.sh` arguments):
- `ROOT_VERSION` (default `6.38.00`)
- `BASE_IMAGE` (default `quay.io/pypa/manylinux_2_28_x86_64`)
- `JOBS` (default: number of CPUs)
- `MUSRFIT_REPO` (default: the sibling `../musrfit.psi` checkout)
## Notes / open items
- The manylinux_2_28 base (AlmaLinux 8, glibc 2.28) is used because ROOT 6.38
needs a C++17 toolchain that the original CentOS 7 / manylinux2014 image does
not provide out of the box. Override `BASE_IMAGE` to target a different glibc
baseline.
- `bundle-deps` copies the non-glibc shared-library closure using an allow-list
of host-provided libraries. Review `runtime/lib` after a build and add any
missing sonames to the allow-list in `build-runtime.sh`.
- The runtime is git-ignored (`runtime/*`, `!runtime/.gitkeep`); only the build
recipe and the placeholder are committed.
- Windows delivery reuses this same Linux tree inside a bundled WSL2
distribution (tracked separately).
## Verifying a build
```sh
runtime/bin/musrt0 --version
ldd runtime/bin/musrt0 | grep -v "$PWD/runtime" # only host-provided libs left
```
+125
View File
@@ -0,0 +1,125 @@
#!/usr/bin/env bash
# Copyright (C) 2026 Zaher Salman
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Build a relocatable ROOT + musrfit runtime for muSRFlow. Runs inside the
# container built from packaging/runtime/Dockerfile (see build.sh for the host
# wrapper). The repo is mounted at /work, so the finished tree lands directly in
# /work/runtime where electron-builder ships it as extraResources.
#
# Environment overrides:
# ROOT_VERSION ROOT release to build (default 6.38.00)
# ROOT_SOURCE "build" (default) or "binary"
# ROOT_BINARY_URL source tarball URL for ROOT_SOURCE=binary
# MUSRFIT_REPO path to the musrfit checkout (default /src/musrfit)
# PREFIX install prefix (default /work/runtime)
# JOBS build parallelism (default: nproc)
set -euo pipefail
ROOT_VERSION="${ROOT_VERSION:-6.38.00}"
ROOT_SOURCE="${ROOT_SOURCE:-build}"
MUSRFIT_REPO="${MUSRFIT_REPO:-/src/musrfit}"
PREFIX="${PREFIX:-/work/runtime}"
JOBS="${JOBS:-$(nproc)}"
ROOT_TARBALL_URL="https://root.cern/download/root_v${ROOT_VERSION}.source.tar.gz"
# Host-provided libraries that must NOT be bundled: the AppImage contract keeps
# the C/C++ runtime, the dynamic loader, and the low-level system calls on the
# host so the bundle works across distributions.
SYSTEM_LIB_RE='^(libc|libm|libmvec|libdl|libpthread|librt|libgcc_s|libstdc\+\+|ld-linux[^/]*|libresolv|libutil|libnsl|libcrypt|libanl|libasound|libdl)\.so'
log() { printf '\n=== %s ===\n' "$*"; }
log "Building ROOT ${ROOT_VERSION} (${ROOT_SOURCE}) into ${PREFIX}"
mkdir -p "$PREFIX"
if [ "$ROOT_SOURCE" = "binary" ]; then
: "${ROOT_BINARY_URL:?ROOT_BINARY_URL is required when ROOT_SOURCE=binary}"
wget -q -O /tmp/root.tar.gz "$ROOT_BINARY_URL"
mkdir -p /tmp/root-bin
tar -C /tmp/root-bin --strip-components=1 -xzf /tmp/root.tar.gz
cp -a /tmp/root-bin/. "$PREFIX/"
else
wget -q -O /tmp/root.tar.gz "$ROOT_TARBALL_URL"
mkdir -p /tmp/root-src
tar -C /tmp/root-src --strip-components=1 -xzf /tmp/root.tar.gz
cmake -S /tmp/root-src -B /tmp/root-build \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-Dgnuinstall=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_RPATH='$ORIGIN/../lib' \
-Droofit=OFF \
-Dtmva=OFF \
-Dhttp=OFF \
-Dsqlite=OFF \
-Dbuiltin_xrootd=OFF \
-Dminuit2=ON \
-Dmathmore=ON \
-Dx11=ON \
-Dopengl=OFF \
-Dpython=OFF \
-Dpythia8=OFF
cmake --build /tmp/root-build -j "$JOBS"
cmake --install /tmp/root-build
fi
log "Building musrfit against ${PREFIX}"
cmake -S "$MUSRFIT_REPO" -B /tmp/musrfit-build \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_RPATH='$ORIGIN/../lib' \
-Dqt_based_tools=OFF \
-Dtry_OpenMP=ON
cmake --build /tmp/musrfit-build -j "$JOBS"
cmake --install /tmp/musrfit-build
# musrfit resolves its default startup file via MUSRFITPATH (set by muSRFlow to
# the runtime root); ship a sane template so a fresh install has one.
if [ -f /work/packaging/runtime/musrfit_startup.xml ] && [ ! -f "$PREFIX/musrfit_startup.xml" ]; then
cp /work/packaging/runtime/musrfit_startup.xml "$PREFIX/musrfit_startup.xml"
fi
log "Patching runpaths to \$ORIGIN"
if command -v patchelf >/dev/null 2>&1; then
find "$PREFIX/bin" -type f -perm -u+x -print0 2>/dev/null \
| xargs -0 -r patchelf --set-rpath '$ORIGIN/../lib' 2>/dev/null || true
find "$PREFIX/lib" -maxdepth 1 -name '*.so*' -type f -print0 2>/dev/null \
| xargs -0 -r patchelf --set-rpath '$ORIGIN' 2>/dev/null || true
else
echo "WARNING: patchelf not found; the runtime may depend on absolute paths" >&2
fi
log "Bundling non-system shared libraries into ${PREFIX}/lib"
bundle_deps() {
local dest="$PREFIX/lib"
local libs base
libs="$(
{
find "$PREFIX/bin" -type f -perm -u+x -exec ldd {} \; 2>/dev/null || true
find "$PREFIX/lib" -maxdepth 1 -name '*.so*' -type f -exec ldd {} \; 2>/dev/null || true
} | awk '/=>/ && $3 ~ /^\// {print $3}' | sort -u
)"
while IFS= read -r lib; do
[ -n "$lib" ] || continue
case "$lib" in
"$PREFIX"/*) continue ;;
esac
base="$(basename "$lib")"
if printf '%s\n' "$base" | grep -Eq "$SYSTEM_LIB_RE"; then
continue
fi
if [ ! -e "$dest/$base" ]; then
cp -Lf "$lib" "$dest/$base"
if command -v patchelf >/dev/null 2>&1; then
patchelf --set-rpath '$ORIGIN' "$dest/$base" 2>/dev/null || true
fi
fi
done <<< "$libs"
}
bundle_deps
log "Result"
du -sh "$PREFIX"
ls "$PREFIX/bin" | head -40
echo "musrfit_startup.xml present: $([ -f "$PREFIX/musrfit_startup.xml" ] && echo yes || echo no)"
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Copyright (C) 2026 Zaher Salman
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Host wrapper: build the runtime image, run the build inside it, and drop the
# relocatable ROOT + musrfit tree into <repo>/runtime for electron-builder.
#
# Requires Docker or Podman. The musrfit checkout is mounted read-only from the
# sibling directory ../musrfit.psi by default; set MUSRFIT_REPO to override.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="$(cd "$HERE/../.." && pwd)"
MUSRFIT_REPO="${MUSRFIT_REPO:-$(cd "$REPO/.." && pwd)/musrfit.psi}"
ROOT_VERSION="${ROOT_VERSION:-6.38.00}"
ROOT_SOURCE="${ROOT_SOURCE:-build}"
BASE_IMAGE="${BASE_IMAGE:-quay.io/pypa/manylinux_2_28_x86_64}"
IMAGE="${IMAGE:-musrflow-runtime-builder}"
JOBS="${JOBS:-$(nproc)}"
if command -v docker >/dev/null 2>&1; then
ENGINE=docker
elif command -v podman >/dev/null 2>&1; then
ENGINE=podman
else
echo "ERROR: docker or podman is required" >&2
exit 1
fi
if [ ! -d "$MUSRFIT_REPO" ]; then
echo "ERROR: musrfit checkout not found at $MUSRFIT_REPO (set MUSRFIT_REPO)" >&2
exit 1
fi
echo "Building image $IMAGE from $BASE_IMAGE"
"$ENGINE" build --build-arg "BASE_IMAGE=$BASE_IMAGE" -t "$IMAGE" "$HERE"
echo "Building runtime into $REPO/runtime"
"$ENGINE" run --rm \
-v "$REPO:/work" \
-v "$MUSRFIT_REPO:/src/musrfit:ro" \
-e "ROOT_VERSION=$ROOT_VERSION" \
-e "ROOT_SOURCE=$ROOT_SOURCE" \
-e "MUSRFIT_REPO=/src/musrfit" \
-e "PREFIX=/work/runtime" \
-e "JOBS=$JOBS" \
"$IMAGE"
echo "Done. Runtime written to $REPO/runtime"
+121
View File
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<musrfit xmlns="https://lmu.pages.psi.ch/musrfit-docu/">
<comment>
Defines default settings for the musrfit package
</comment>
<data_path>/psi.ch/group/lmu/public/data/lem/his</data_path>
<data_path>/psi.ch/group/lmu/public/data/alc/his</data_path>
<data_path>/psi.ch/group/lmu/public/data/dolly/his</data_path>
<data_path>/psi.ch/group/lmu/public/data/flame/his</data_path>
<data_path>/psi.ch/group/lmu/public/data/gpd/his</data_path>
<data_path>/psi.ch/group/lmu/public/data/gps/his</data_path>
<data_path>/psi.ch/group/lmu/public/data/hal/his</data_path>
<data_path>/psi.ch/group/lmu/public/data/ltf/his</data_path>
<data_path>/psi.ch/group/lmu/public/data/misc/his</data_path>
<data_path>/psi.ch/group/lmu/public/data/vms/his</data_path>
<!-- MISC/PSI 1985 - 1990 -->
<run_name_template inst="misc">d%yyyy%/deltat_misc_%rrrr%.bin</run_name_template>
<!-- ALC TD/PSI -->
<run_name_template inst="alc">d%yyyy%/deltat_zh_chem_%rrrr%.bin</run_name_template>
<run_name_template inst="alc">d%yyyy%/deltat_tdc_alc_%rrrr%.bin</run_name_template>
<run_name_template inst="alc">d%yyyy%/tdc/deltat_tdc_alc_%rrrr%.bin</run_name_template>
<!-- VMS/PSI -->
<run_name_template inst="vms">d%yyyy%/tdc/root/deltat_tdc_vms_%yyyy%_%rrrr%.root</run_name_template>
<!-- Dolly/PSI -->
<run_name_template inst="dolly">d%yyyy%/tdc/root/deltat_tdc_dolly_%yyyy%_%rrrr%.root</run_name_template>
<run_name_template inst="dolly">d%yyyy%/pie1/deltat_flc_%rrrr%.bin</run_name_template>
<run_name_template inst="dolly">d%yyyy%/pie3/deltat_flc_%rrrr%.bin</run_name_template>
<run_name_template inst="dolly">d%yyyy%/deltat_flc_%rrrr%.bin</run_name_template>
<run_name_template inst="dolly">d%yyyy%/deltat_pta_dolly_%rrrr%.bin</run_name_template>
<run_name_template inst="dolly">d%yyyy%/pta/deltat_pta_dolly_%rrrr%.bin</run_name_template>
<run_name_template inst="dolly">d%yyyy%/tdc/deltat_tdc_dolly_%rrrr%.bin</run_name_template>
<run_name_template inst="dolly">d%yyyy%/tdc/mdu/deltat_tdc_dolly_%rrrr%.mdu</run_name_template>
<!-- Flame/PSI -->
<run_name_template inst="flame">d%yyyy%/tdc/root/deltat_tdc_flame_%yyyy%_%rrrr%.root</run_name_template>
<run_name_template inst="flame">d%yyyy%/tdc/deltat_tdc_flame_%rrrr%.bin</run_name_template>
<run_name_template inst="flame">d%yyyy%/tdc/mdu/deltat_tdc_flame_%yyyy%_%rrrr%.mdu</run_name_template>
<!-- GPD/PSI -->
<run_name_template inst="gpd">d%yyyy%/tdc/root/deltat_tdc_gpd_%yyyy%_%rrrr%.root</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_mue1_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_fq_si_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_strobo_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_hp_ni_ht_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_hp_ni_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_ccr2_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_gpd_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_janis_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_janis_gpd_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/deltat_pta_gpd_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/pta/deltat_pta_gpd_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/tdc/deltat_tdc_gpd_%rrrr%.bin</run_name_template>
<run_name_template inst="gpd">d%yyyy%/tdc/mdu/deltat_tdc_gpd_%rrrr%.mdu</run_name_template>
<!-- GPS/PSI -->
<run_name_template inst="gps">d%yyyy%/tdc/root/deltat_tdc_gps_%yyyy%_%rrrr%.root</run_name_template>
<run_name_template inst="gps">d%yyyy%/deltat_ccr_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/deltat_he3_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/deltat_stutt_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/deltat_ltf_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/deltat_flc_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/deltat_flc2_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/deltat_oven_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/deltat_oven2_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/deltat_pta_gps_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/tdc/deltat_tdc_gps_%rrrr%.bin</run_name_template>
<run_name_template inst="gps">d%yyyy%/tdc/mdu/deltat_tdc_gps_%yyyy%_%rrrr%.mdu</run_name_template>
<!-- HAL-9500/PSI == HIFI/PSI -->
<run_name_template inst="hifi">d%yyyy%/tdc/root/deltat_tdc_hifi_%yyyy%_%rrrr%.root</run_name_template>
<run_name_template inst="hifi">d%yyyy%/tdc/deltat_hifi_%rrrr%.bin</run_name_template>
<run_name_template inst="hifi">d%yyyy%/tdc/tdc_hifi_%yyyy%_%rrrrr%.mdu</run_name_template>
<run_name_template inst="hifi">d%yyyy%/tdc/root/deltat_tdc_hifi_%yyyy%_%rrrr%.mdu</run_name_template>
<!-- LTF/PSI -->
<run_name_template inst="ltf">d%yyyy%/deltat_ltf_%rrrr%.bin</run_name_template>
<run_name_template inst="ltf">d%yyyy%/deltat_ltf2_%rrrr%.bin</run_name_template>
<run_name_template inst="ltf">d%yyyy%/deltat_pta_ltf_%rrrr%.bin</run_name_template>
<run_name_template inst="ltf">d%yyyy%/pta/deltat_pta_ltf_%rrrr%.bin</run_name_template>
<run_name_template inst="ltf">d%yyyy%/tdc/deltat_tdc_ltf_%rrrr%.bin</run_name_template>
<!-- LEM/PSI -->
<run_name_template inst="lem">%yyyy%/lem%yy%_his_%rrrr%.root</run_name_template>
<run_name_template inst="lem">d%yyyy%/tdc/lem%yy%_his_%rrrr%.root</run_name_template>
<run_name_template inst="lem">%yyyy%/lem%yy%_his_%rrrrr%.root</run_name_template>
<run_name_template inst="lem">d%yyyy%/tdc/lem%yy%_his_%rrrrr%.root</run_name_template>
<fourier_settings>
<units>Gauss</units>
<fourier_power>0</fourier_power>
<apodization>none</apodization>
<plot>real_and_imag</plot>
<phase>0.0</phase>
<phase_increment>1.0</phase_increment>
</fourier_settings>
<root_settings>
<marker_list>
<!-- Root marker numbers -->
<marker>24</marker> <!-- open circle -->
<marker>25</marker> <!-- open square -->
<marker>26</marker> <!-- open triangle -->
<marker>27</marker> <!-- open diamond -->
<marker>28</marker> <!-- open cross -->
<marker>29</marker> <!-- full star -->
<marker>30</marker> <!-- open star -->
<marker>20</marker> <!-- full circle -->
<marker>21</marker> <!-- full square -->
<marker>22</marker> <!-- full triangle -->
<marker>23</marker> <!-- full triangle down -->
<marker>2</marker> <!-- thin cross -->
<marker>3</marker> <!-- thin star -->
<marker>5</marker> <!-- thin x -->
</marker_list>
<color_list>
<!-- Color as RGB coded string -->
<color>0,0,0</color> <!-- kBlack -->
<color>255,0,0</color> <!-- kRed -->
<color>0,153,0</color> <!-- kGreen+2 -->
<color>0,0,255</color> <!-- kBlue -->
<color>255,0,255</color> <!-- kMagenta -->
<color>0,255,255</color> <!-- kCyan -->
<color>153,0,255</color> <!-- kViolet-3 -->
<color>102,102,51</color> <!-- kYellow-1 -->
<color>51,102,51</color> <!-- kGreen-1 -->
<color>153,0,0</color> <!-- kRed+2 -->
</color_list>
</root_settings>
</musrfit>
View File
Whitespace-only changes.
+149
View File
@@ -0,0 +1,149 @@
// Copyright (C) 2026 Zaher Salman
// SPDX-License-Identifier: GPL-3.0-or-later
// Bundled ROOT + musrfit runtime resolution. When a relocatable runtime is
// shipped under <resources>/runtime, muSRFlow must discover its bin directory,
// prefer it over the host installation (but still yield to a user-configured
// tools directory), and point ROOTSYS/MUSRFITPATH/LD_LIBRARY_PATH at it when
// spawning musrfit tools. Without the bundle everything falls back to the host.
const assert = require("assert");
const fs = require("fs");
const os = require("os");
const path = require("path");
const vm = require("vm");
const repoRoot = path.resolve(__dirname, "..");
const testRoot = fs.mkdtempSync(path.join(os.tmpdir(), "musrflow-runtime-"));
const emptyCwd = path.join(testRoot, "cwd");
const emptyHome = path.join(testRoot, "home");
fs.mkdirSync(emptyCwd, { recursive: true });
fs.mkdirSync(emptyHome, { recursive: true });
const runtimeRoot = path.join(testRoot, "resources", "runtime");
fs.mkdirSync(path.join(runtimeRoot, "bin"), { recursive: true });
fs.mkdirSync(path.join(runtimeRoot, "lib"), { recursive: true });
fs.writeFileSync(path.join(runtimeRoot, "bin", "musrfit"), "#!/bin/sh\n");
fs.writeFileSync(path.join(runtimeRoot, "bin", "musrt0"), "#!/bin/sh\n");
fs.writeFileSync(path.join(runtimeRoot, "lib", "libPMusr.so"), "");
fs.writeFileSync(path.join(runtimeRoot, "musrfit_startup.xml"),
"<musrfit>\n<data_path>" + emptyCwd + "</data_path>\n</musrfit>\n");
function localStoreFactory() {
const store = {};
return {
getItem: function(key) {
return Object.prototype.hasOwnProperty.call(store, key) ? store[key] : null;
},
setItem: function(key, value) { store[key] = String(value); },
removeItem: function(key) { delete store[key]; }
};
}
function buildSandbox(resourcesPath, envOverrides) {
const sandbox = {
console: { log: function() {}, error: console.error, warn: console.warn },
document: { getElementById: function() { return null; } },
process: {
cwd: function() { return emptyCwd; },
env: Object.assign({ HOME: emptyHome }, envOverrides || {}),
resourcesPath: resourcesPath
},
require: require,
window: {
electronIpcRenderer: { on: function() {}, send: function() {} },
nodeChildProcess: {},
nodeFs: fs,
nodePath: path,
localStorage: localStoreFactory()
}
};
sandbox.global = sandbox;
return sandbox;
}
function loadLibraries(sandbox) {
vm.runInNewContext(
fs.readFileSync(path.join(repoRoot, "muSRFitlib.js"), "utf8"),
sandbox, { filename: "muSRFitlib.js" });
vm.runInNewContext(
fs.readFileSync(path.join(repoRoot, "muSRFitelec.js"), "utf8"),
sandbox, { filename: "muSRFitelec.js" });
}
const resourcesPath = path.join(testRoot, "resources");
// With the bundle present the runtime bin must win over /usr/local/bin and the
// spawn environment must expose ROOTSYS, MUSRFITPATH, and LD_LIBRARY_PATH.
(function testBundledRuntimeIsPreferredAndExported() {
const sandbox = buildSandbox(resourcesPath, { LD_LIBRARY_PATH: "/host/lib" });
loadLibraries(sandbox);
assert.strictEqual(sandbox.bundledRuntimeRoot(), runtimeRoot);
assert.strictEqual(
sandbox.resolveLocalCommand("musrfit"),
path.join(runtimeRoot, "bin", "musrfit"));
assert.strictEqual(
sandbox.resolveLocalCommand("musrt0"),
path.join(runtimeRoot, "bin", "musrt0"));
assert.strictEqual(
sandbox.localCommandPathBias().indexOf(path.join(runtimeRoot, "bin") + ":") === 0,
true);
const env = sandbox.buildToolEnvironment();
assert.strictEqual(env.ROOTSYS, runtimeRoot);
assert.strictEqual(env.MUSRFITPATH, runtimeRoot);
assert.strictEqual(env.LD_LIBRARY_PATH,
path.join(runtimeRoot, "lib") + ":/host/lib");
assert.strictEqual(env.PATH.indexOf(path.join(runtimeRoot, "bin") + ":") === 0, true);
})();
// An explicit user-configured tools directory must still outrank the bundle,
// both for command resolution and for the PATH bias.
(function testConfiguredBinDirOutranksBundle() {
const tools = path.join(testRoot, "tools");
fs.mkdirSync(tools, { recursive: true });
fs.writeFileSync(path.join(tools, "musrfit"), "#!/bin/sh\n");
const sandbox = buildSandbox(resourcesPath, {});
loadLibraries(sandbox);
sandbox.window.localStorage.setItem("musrflow.binDir", tools);
assert.strictEqual(
sandbox.resolveLocalCommand("musrfit"),
path.join(tools, "musrfit"));
assert.strictEqual(
sandbox.localCommandPathBias().indexOf(tools + ":" + path.join(runtimeRoot, "bin") + ":") === 0,
true);
})();
// Without the bundle (no runtime/bin/musrfit) detection is off and the host
// environment is passed through unchanged.
(function testNoBundleFallsBackToHost() {
const plainResources = path.join(testRoot, "plain-resources");
fs.mkdirSync(plainResources, { recursive: true });
const sandbox = buildSandbox(plainResources, {});
loadLibraries(sandbox);
assert.strictEqual(sandbox.bundledRuntimeRoot(), "");
assert.strictEqual(sandbox.bundledRuntimeBinDir(), "");
const env = sandbox.buildToolEnvironment();
assert.strictEqual(env.ROOTSYS, undefined);
assert.strictEqual(env.MUSRFITPATH, undefined);
assert.strictEqual(env.LD_LIBRARY_PATH, undefined);
assert.strictEqual(env.PATH.indexOf(plainResources) === -1, true);
})();
// The startup XML shipped with the bundle is used as the last resort when no
// user, home, or working-directory startup file exists.
(function testBundledStartupXmlFallback() {
const sandbox = buildSandbox(resourcesPath, {});
loadLibraries(sandbox);
assert.strictEqual(
sandbox.loadLocalPortableRunNaming(),
path.join(runtimeRoot, "musrfit_startup.xml"));
})();
console.log("Bundled runtime resolution tests passed");