870 lines
46 KiB
HTML
870 lines
46 KiB
HTML
<!--
|
|
Copyright (C) 2026 Zaher Salman
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
-->
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="icon" type="image/png" sizes="64x64" href="assets/musrflow-favicon.png">
|
|
<link rel="apple-touch-icon" href="assets/musrflow-icon.png">
|
|
<link rel="stylesheet" href="ZGUI.css?v=20260827">
|
|
<script>
|
|
if (window.electronAPI) {
|
|
document.write('<script src="muSRFitParameterPlotElec.js"><\/script>');
|
|
document.write('<script src="muSRFitelec.js"><\/script>');
|
|
} else {
|
|
// The browser build loads the JSROOT bridge before the web runner so
|
|
// completed jobs can open ROOT canvases immediately.
|
|
document.write('<script src="muSRFitRoot.js"><\/script>');
|
|
document.write('<script src="muSRFitweb.js"><\/script>');
|
|
}
|
|
</script>
|
|
<script src="muSRFitParameterPlot.js"></script>
|
|
<script src="muSRFitlib.js"></script>
|
|
<title>muSRFlow</title>
|
|
</head>
|
|
<body onload="adjustComps();defaultHistograms(1);updateTheoryBlock();updatePlotOptionVisibility();cfgFFTRRF();initializeDataRoot();initializeWorkPath();initializeFileSuffixes();initializeInitialParameterGuessPreference();initializeT0FromPromptPeak();initializeStartupXml();initializeBinDir();initializeMusrfitThreads();if (amIWeb() && typeof initializeWebURLParameters === 'function') initializeWebURLParameters();">
|
|
<main class="app-shell" id="appShell" aria-busy="false">
|
|
<div class="app-card">
|
|
<div class="tab">
|
|
<button type="button" class="tablinks" onclick="openTab(event,'Runs')" id="btnRuns">Runs</button>
|
|
<button type="button" class="tablinks" onclick="openTab(event,'Params');cfgParams();" id="btnParams">Parameters</button>
|
|
<button type="button" class="tablinks" onclick="openTab(event,'Functions');cfgConstraints();" id="btnFunctions">Constraints</button>
|
|
<button type="button" class="tablinks" onclick="openTab(event,'t0Bg');cfgt0Bg();" id="btnt0Bg">t<sub>0</sub>/Bg</button>
|
|
<button type="button" class="tablinks" onclick="openTab(event,'Editor');initMSREditor();" id="btnEditor">MSR Editor</button>
|
|
<button type="button" class="tablinks" onclick="openTab(event,'Jobs');renderJobStatus();" id="btnJobs">Results</button>
|
|
<button type="button" class="help-button" onclick="showQuickStartHelp();"
|
|
title="Quick Start / Help" aria-label="Quick Start / Help">?</button>
|
|
<button type="button" class="help-button share-button" id="shareConfigButton"
|
|
onclick="copyWebConfigurationLink();"
|
|
title="Copy configuration link" aria-label="Copy configuration link">
|
|
<svg class="share-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
<circle cx="18" cy="5" r="2.5"></circle>
|
|
<circle cx="6" cy="12" r="2.5"></circle>
|
|
<circle cx="18" cy="19" r="2.5"></circle>
|
|
<path d="M8.2 10.8 15.8 6.2M8.2 13.2l7.6 4.6"></path>
|
|
</svg>
|
|
</button>
|
|
<!-- Desktop-app configuration link. Browsers cannot hand the https link to
|
|
the installed muSRFlow build, so the web Share flow also emits a
|
|
musrflow:// link for desktop users. Shown only by the web shell. -->
|
|
<button type="button" class="help-button share-button" id="desktopLinkButton"
|
|
onclick="if (typeof copyWebDesktopConfigurationLink === 'function') copyWebDesktopConfigurationLink();"
|
|
title="Copy desktop-app configuration link"
|
|
aria-label="Copy desktop-app configuration link" hidden>
|
|
<svg class="share-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
<rect x="2" y="3" width="20" height="14" rx="2"></rect>
|
|
<path d="M8 21h8M12 17v4"></path>
|
|
</svg>
|
|
</button>
|
|
<!-- Save Session records the analysis state in the working directory and
|
|
is Electron-only: the web deployment has no filesystem to persist to. -->
|
|
<button type="button" class="help-button share-button" id="saveSessionButton"
|
|
onclick="if (typeof saveElectronSession === 'function') saveElectronSession();"
|
|
title="Save session to the working directory" aria-label="Save session to the working directory" hidden>
|
|
<svg class="share-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
<path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"></path>
|
|
<path d="M17 21v-8H7v8M7 3v5h8"></path>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div class="main-action-bar" role="toolbar" aria-label="Main workflow actions">
|
|
<div class="action-bar-title">
|
|
<img class="app-brand-icon" src="assets/musrflow-icon.png" alt="" aria-hidden="true">
|
|
<div class="action-bar-title-text">
|
|
<span class="action-bar-eyebrow">muSRFlow</span>
|
|
<strong>Streamlined μSR workflow</strong>
|
|
</div>
|
|
</div>
|
|
<div class="action-bar-activity" id="musrfitActionActivity"
|
|
role="status" aria-live="polite" hidden>
|
|
<span class="action-activity-spinner" aria-hidden="true"></span>
|
|
<span id="musrfitActionActivityText"></span>
|
|
</div>
|
|
<div class="action-bar-buttons">
|
|
<button type="button" class="action-btn action-btn-primary" id="FitMSR" onclick="startFit();">Fit</button>
|
|
<button type="button" class="action-btn action-btn-secondary" id="PlotMSR" onclick="startPlot();">Plot</button>
|
|
</div>
|
|
</div>
|
|
<div id="Runs" class="tabcontent">
|
|
<!-- Run selection uses the same compact section language as Fit range/model/options.
|
|
The run list gets the flexible space because it is the value users edit most. -->
|
|
<div class="compact-settings-header"><b>Runs</b></div>
|
|
<div class="compact-settings-row runs-options-row">
|
|
<div class="run-option-field run-number-field" id="runSourceField">
|
|
<select id="runSourceMode" class="run-source-mode-select" aria-label="Run input mode" title="Run input mode"
|
|
onchange="setRunSourceMode(this.value);">
|
|
<option selected="selected" value="numbers">Run(s)</option>
|
|
<option value="mixed">Mixed</option>
|
|
</select>
|
|
<input type="text" id="runNumbers" data-run-source="numbers" value=""
|
|
placeholder="e.g. 514, 516, 520-525, 530+531"
|
|
title="Use commas/ranges for separate data sets and + to add runs (ADDRUN). Examples: 514, 516, 520-525, 520:540:2 or 514+515"
|
|
oninput="legalRunNumbers(this.value);updateResolvedDataPathPreview();"
|
|
onchange="handleRunSelectionChange(this.value);">
|
|
<input type="text" id="mixedFiles" data-run-source="mixed" value=""
|
|
placeholder="e.g. 2025/LEM/1014, 2024/GPS/0567 or /path/to/file.root"
|
|
title="Comma-separated datasets; + adds runs (ADDRUN). Each item is year/instrument/run or an explicit file/path. Ranges/steps are not supported."
|
|
oninput="updateResolvedDataPathPreview();"
|
|
onchange="handleMixedFilesChange(this.value);" hidden disabled>
|
|
</div>
|
|
<label class="run-option-field run-year-field" for="selYear" data-run-source="numbers">
|
|
<span>Year</span>
|
|
<input type="number" id="selYear" oninput="updateResolvedDataPathPreview();">
|
|
</label>
|
|
<label class="run-option-field run-instrument-field" for="instrName" data-run-source="numbers">
|
|
<span>Instrument</span>
|
|
<select id="instrName" onchange="defaultHistograms(1);updateResolvedDataPathPreview();">
|
|
<option value="LTF">LTF</option>
|
|
<option value="FLAME">FLAME</option>
|
|
<option selected="selected" value="LEM">LEM</option>
|
|
<option value="GPS">GPS</option>
|
|
<option value="GPD">GPD</option>
|
|
<option value="Dolly">Dolly</option>
|
|
<option value="VMS">VMS</option>
|
|
<option value="HAL">HAL</option>
|
|
</select>
|
|
</label>
|
|
</div>
|
|
<!-- Successful RUN-path resolution is intentionally silent. The same compact
|
|
warning also carries action-time validation when Generate/Fit/Plot is
|
|
requested without a usable run selection. -->
|
|
<div class="data-path-warning" id="dataPathResolutionWarning" role="status" aria-live="polite" hidden>
|
|
<span class="data-path-warning-label" id="dataPathResolutionLabel">Runs</span>
|
|
<span class="data-path-warning-message" id="dataPathResolutionMessage"></span>
|
|
</div>
|
|
<!-- All compact analysis groups use the same header treatment. Keeping this
|
|
generic also lets the Fit model section adopt the same compact structure
|
|
without introducing another one-off style later. -->
|
|
<div class="compact-settings-header"><b>Fit range</b></div>
|
|
<!-- Fit limits affect the numerical result and therefore stay visible. Plot-only
|
|
controls now live with FFT/RRF in the separate View settings row below. -->
|
|
<div class="compact-settings-row range-options-row">
|
|
<label class="range-option-field" for="Tis">
|
|
<span>From</span>
|
|
<input type="text" id="Tis" value="0" aria-label="Fit start time in microseconds">
|
|
</label>
|
|
<span class="range-separator" aria-hidden="true">–</span>
|
|
<label class="range-option-field" for="Tfs">
|
|
<span>To</span>
|
|
<input type="text" id="Tfs" value="8" aria-label="Fit end time in microseconds">
|
|
</label>
|
|
<span class="range-unit">μs</span>
|
|
<label class="range-option-field range-packing-field" for="BINS">
|
|
<span>Packing</span>
|
|
<input type="text" id="BINS" value="100">
|
|
</label>
|
|
</div>
|
|
|
|
<div class="compact-settings-header"><b>Fit model</b></div>
|
|
<!-- The model uses the same compact one-row language as Fit range/options.
|
|
Component count is derived from the component list: + adds a model and
|
|
each additional component can remove itself, avoiding duplicate state. -->
|
|
<div class="compact-settings-row fit-model-row">
|
|
<label class="fit-model-field" for="fitAsyType">
|
|
<span>Type</span>
|
|
<select id="fitAsyType" onchange="updatePlotOptionVisibility();clearTabs(true);">
|
|
<option selected="selected" value="AsymmetryGLB">Asymmetry</option>
|
|
<option value="SingleHist">Single Hist</option>
|
|
<option hidden value="Asymmetry">Asymmetry Legacy</option>
|
|
</select>
|
|
</label>
|
|
<label class="fit-model-field fit-model-histograms" for="LRBF">
|
|
<span>Histograms</span>
|
|
<input type="text" id="LRBF" onchange="clearTabs();"
|
|
title="Histograms that form the asymmetry signal, e.g. 21 25 (forward,backward).
|
|
Single hist fits take one histogram number.
|
|
Multiple groups of one run can be fit simultaneously with slash-separated pairs:
|
|
1,2/3,4 two groups (detectors 1+2 yield the first, 3+4 the second),
|
|
each with its own alpha/phase and a ratio scaling a shared amplitude.
|
|
Multi-group fits are not available for multi-component models or per-run
|
|
pairs of a multi-run (global) fit.">
|
|
</label>
|
|
<div class="fit-model-components" id="compRows" aria-label="Fit model components"></div>
|
|
<button class="fit-model-add" type="button" onclick="addFitComponent();" title="Add fit component" aria-label="Add fit component">+</button>
|
|
<!-- numComps stays as a hidden compatibility field because existing MSR
|
|
generation reads it through prepCFG(). Its value is maintained only by
|
|
the component-list helpers and is no longer user-editable directly. -->
|
|
<input id="numComps" type="hidden" value="1">
|
|
</div>
|
|
<div class="compact-settings-header"><b>Fit options</b></div>
|
|
<!-- Keep the commonly used Minuit2 controls on one compact line. The GUI
|
|
stores exact musrfit command values while labels/tooltips remain concise. -->
|
|
<div class="compact-settings-row fit-options-row">
|
|
<label class="fit-option-field" for="minType">
|
|
<span>Minimizer</span>
|
|
<select id="minType" title="Minuit2 minimizer used for the fit">
|
|
<option selected="selected" value="MINIMIZE">MINIMIZE</option>
|
|
<option value="MIGRAD">MIGRAD</option>
|
|
<option value="SIMPLEX">SIMPLEX</option>
|
|
</select>
|
|
</label>
|
|
<label class="fit-option-field" for="errEst">
|
|
<span>Errors</span>
|
|
<select id="errEst" title="Error calculation performed after minimization">
|
|
<option selected="selected" value="HESSE">HESSE</option>
|
|
<option value="MINOS">MINOS</option>
|
|
<option value="HESSE_MINOS">HESSE + MINOS</option>
|
|
<option value="NONE">None</option>
|
|
</select>
|
|
</label>
|
|
<label class="fit-option-field" for="minStrategy">
|
|
<span>Strategy</span>
|
|
<select id="minStrategy" title="Minuit2 strategy; Default leaves it unspecified">
|
|
<option selected="selected" value="">Default</option>
|
|
<option value="0">0</option>
|
|
<option value="1">1</option>
|
|
<option value="2">2</option>
|
|
</select>
|
|
</label>
|
|
<label class="fit-option-field" for="fitObjective">
|
|
<span>Objective</span>
|
|
<select id="fitObjective" title="Use chi-square or maximum log-likelihood">
|
|
<option selected="selected" value="CHI2">χ²</option>
|
|
<option value="MAX_LIKELIHOOD">Max likelihood</option>
|
|
</select>
|
|
</label>
|
|
<label class="fit-option-save" for="saveMinuit" title="Write detailed Minuit2 output including covariance information">
|
|
<input id="saveMinuit" type="checkbox" checked="checked">
|
|
<span>Save</span>
|
|
</label>
|
|
</div>
|
|
<!-- Per-run series actions appear only when the independent-series route is
|
|
eligible: ≥2 data sets and no Shared parameters. Each chip cycles
|
|
reuse → refit → skip → reuse on click; the "all" selector sets every
|
|
chip to one action at once. -->
|
|
<div class="compact-settings-row series-actions-row" id="seriesActionsRow" hidden>
|
|
<label class="series-actions-bulk" for="seriesActionAll" title="Set the series action for every run at once">
|
|
<select id="seriesActionAll">
|
|
<option value="">All</option>
|
|
<option value="reuse">Reuse all</option>
|
|
<option value="refit">Refit all</option>
|
|
<option value="skip">Skip all</option>
|
|
</select>
|
|
</label>
|
|
<div class="series-action-chips" id="seriesActionChips"></div>
|
|
</div>
|
|
<!-- Plot, FFT and RRF share one inline expansion area. The compact buttons
|
|
stay visible on one row; only one settings group is expanded at a time. -->
|
|
<div class="compact-settings-header"><b>View settings</b></div>
|
|
<div class="compact-settings-row plot-view-options-row" id="viewSettingsButtons">
|
|
<button class="view-settings-toggle plot-options-disclosure" id="plotOptionsDisclosure"
|
|
type="button" aria-expanded="false" aria-controls="plotOptionsPanel"
|
|
onclick="toggleViewSettingsPanel('plot');"
|
|
title="Plot time/Y ranges, view packing, and logarithmic axes">
|
|
<span>Plot</span><span class="plot-options-active-dot" aria-hidden="true">•</span>
|
|
</button>
|
|
<button class="view-settings-toggle fft-options-disclosure" id="fftOptionsDisclosure"
|
|
type="button" aria-expanded="false" aria-controls="fftOptionsPanel"
|
|
onclick="toggleViewSettingsPanel('fft');"
|
|
title="Fourier-transform display settings">
|
|
<span>FFT</span><span class="fft-options-active-dot" aria-hidden="true">•</span>
|
|
</button>
|
|
<button class="view-settings-toggle rrf-options-disclosure" id="rrfOptionsDisclosure"
|
|
type="button" aria-expanded="false" aria-controls="rrfOptionsPanel"
|
|
onclick="toggleViewSettingsPanel('rrf');"
|
|
title="Rotating-reference-frame display settings">
|
|
<span>RRF</span><span class="rrf-options-active-dot" aria-hidden="true">•</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- The shared panel uses the full Runs-tab width. This avoids narrow floating
|
|
popups and lets FFT/RRF controls wrap naturally on small displays. -->
|
|
<div class="view-settings-panel" id="viewSettingsPanel" hidden>
|
|
<div class="view-settings-panel-content plot-options-panel" id="plotOptionsPanel" hidden>
|
|
<div class="plot-range-fields">
|
|
<span class="plot-options-label">Time range</span>
|
|
<input type="text" id="Tpis" placeholder="Auto" aria-label="Plot start time" oninput="updatePlotOptionsIndicator();">
|
|
<span class="range-separator" aria-hidden="true">–</span>
|
|
<input type="text" id="Tpfs" placeholder="Auto" aria-label="Plot end time" oninput="updatePlotOptionsIndicator();">
|
|
<span class="range-unit">μs</span>
|
|
</div>
|
|
<div class="plot-range-fields">
|
|
<span class="plot-options-label">Y range</span>
|
|
<input type="text" id="Ypis" placeholder="Auto" aria-label="Plot Y minimum" oninput="updatePlotOptionsIndicator();">
|
|
<span class="range-separator" aria-hidden="true">–</span>
|
|
<input type="text" id="Ypfs" placeholder="Auto" aria-label="Plot Y maximum" oninput="updatePlotOptionsIndicator();">
|
|
</div>
|
|
<label class="plot-option-field" for="VIEWBINS">
|
|
<span>View packing</span>
|
|
<input type="text" id="VIEWBINS" placeholder="Auto" oninput="updatePlotOptionsIndicator();">
|
|
</label>
|
|
<label class="plot-option-check" for="plotLogX">
|
|
<input type="checkbox" id="plotLogX" onchange="updatePlotOptionsIndicator();">
|
|
<span>Log X</span>
|
|
</label>
|
|
<label class="plot-option-check" for="plotLogY">
|
|
<input type="checkbox" id="plotLogY" onchange="updatePlotOptionsIndicator();">
|
|
<span>Log Y</span>
|
|
</label>
|
|
<label class="plot-option-check" id="plotLifetimeCorrectionWrap" for="plotLifetimeCorrection">
|
|
<input checked type="checkbox" id="plotLifetimeCorrection" onchange="updatePlotOptionsIndicator();">
|
|
<span>Lifetime correction</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="view-settings-panel-content fft-options-panel" id="fftOptionsPanel" hidden>
|
|
<label class="fft-rrf-field fft-type-field" for="fftType">
|
|
<span>Type</span>
|
|
<select id="fftType" onchange="updateFFTOptionsIndicator();">
|
|
<option value="power">Power</option>
|
|
<option value="real">Real</option>
|
|
<option value="imag">Imaginary</option>
|
|
<option value="real_and_imag">Real & imaginary</option>
|
|
<option value="phase">Phase</option>
|
|
</select>
|
|
</label>
|
|
<label class="fft-rrf-field fft-apod-field" for="fftApod">
|
|
<span>Apodization</span>
|
|
<select id="fftApod" onchange="updateFFTOptionsIndicator();">
|
|
<option value="STRONG">Strong</option>
|
|
<option value="MEDIUM">Medium</option>
|
|
<option value="WEAK">Weak</option>
|
|
<option value="NONE">None</option>
|
|
</select>
|
|
</label>
|
|
<!-- Phase remains editable for every FFT display type because musrview
|
|
can switch between power/real/imaginary views interactively. -->
|
|
<label class="fft-rrf-field fft-phase-field" for="fftPhase">
|
|
<span>Phase</span>
|
|
<input type="text" id="fftPhase" value="8.5" oninput="updateFFTOptionsIndicator();"
|
|
title="Phase value or musrfit phase expression, e.g. 8.5, par7, par(7,5,16), parR(...)">
|
|
</label>
|
|
<label class="fft-dc-correct-field" for="fftDCCorrect"
|
|
title="Remove the time-domain DC offset before the Fourier transform">
|
|
<input type="checkbox" id="fftDCCorrect" onchange="updateFFTOptionsIndicator();">
|
|
<span>DC correct</span>
|
|
</label>
|
|
<div class="fft-range-field" aria-label="FFT range">
|
|
<span class="fft-options-label">Range</span>
|
|
<input type="text" id="fftxi" value="" placeholder="Auto" aria-label="FFT range start" oninput="updateFFTOptionsIndicator();">
|
|
<span class="fft-rrf-separator" aria-hidden="true">–</span>
|
|
<input type="text" id="fftxf" value="" placeholder="Auto" aria-label="FFT range end" oninput="updateFFTOptionsIndicator();">
|
|
</div>
|
|
<label class="fft-rrf-field fft-units-field" for="fftUnits">
|
|
<span>Units</span>
|
|
<select id="fftUnits" onchange="updateFFTOptionsIndicator();">
|
|
<option value="MHz">MHz</option>
|
|
<option selected="selected" value="Gauss">Gauss</option>
|
|
<option value="Tesla">Tesla</option>
|
|
<option value="Mc/s">Mc/s</option>
|
|
</select>
|
|
</label>
|
|
<label class="fft-rrf-field fft-number-field" for="fftPower">
|
|
<span>Power</span>
|
|
<input type="text" id="fftPower" value="12" oninput="updateFFTOptionsIndicator();">
|
|
</label>
|
|
<label class="fft-rrf-field fft-phase-correction-field" for="fftPhaseCorrection">
|
|
<span>Phase correction</span>
|
|
<select id="fftPhaseCorrection" onchange="updateFFTPhaseCorrectionVisibility();">
|
|
<option selected="selected" value="off">Off</option>
|
|
<option value="all">FFT range</option>
|
|
<option value="custom">Custom range</option>
|
|
</select>
|
|
</label>
|
|
<div class="fft-phase-correction-range" id="fftPhaseCorrectionRange" hidden
|
|
aria-label="Automatic phase-correction range">
|
|
<input type="text" id="fftPhaseCorrectionStart" placeholder="From"
|
|
aria-label="Phase-correction range start" oninput="updateFFTOptionsIndicator();">
|
|
<span class="fft-rrf-separator" aria-hidden="true">–</span>
|
|
<input type="text" id="fftPhaseCorrectionEnd" placeholder="To"
|
|
aria-label="Phase-correction range end" oninput="updateFFTOptionsIndicator();">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="view-settings-panel-content rrf-options-panel" id="rrfOptionsPanel" hidden>
|
|
<!-- RRF stays explicitly opt-in. Opening its settings must not itself
|
|
change the generated PLOT block. -->
|
|
<label class="rrf-enable-field" for="rrfEnabled"
|
|
title="Add rotating-reference-frame directives to the PLOT block">
|
|
<input type="checkbox" id="rrfEnabled" onchange="updateRRFVisibility();">
|
|
<span>Enable</span>
|
|
</label>
|
|
<div class="rrf-settings-inline" id="rrfSettings">
|
|
<div class="rrf-frequency-field" aria-label="RRF frequency">
|
|
<label for="rrfFrq">Frequency</label>
|
|
<input type="text" id="rrfFrq" value="" required inputmode="decimal"
|
|
placeholder="Required" aria-required="true">
|
|
<!-- RRF uses the native short token G while the GUI shows Gauss. -->
|
|
<select id="rrfUnits" aria-label="RRF frequency units">
|
|
<option value="MHz">MHz</option>
|
|
<option value="kHz">kHz</option>
|
|
<option value="Mc/s">Mc/s</option>
|
|
<option selected="selected" value="G">Gauss</option>
|
|
<option value="T">Tesla</option>
|
|
</select>
|
|
</div>
|
|
<label class="fft-rrf-field fft-number-field" for="rrfPack">
|
|
<span>Packing</span>
|
|
<input type="text" id="rrfPack" value="" required inputmode="numeric"
|
|
placeholder="Required" aria-required="true">
|
|
</label>
|
|
<label class="fft-rrf-field fft-number-field" for="rrfPhase">
|
|
<span>Phase</span>
|
|
<input type="text" id="rrfPhase" value="" placeholder="0 (optional)"
|
|
title="Optional phase in degrees or a parameter reference such as par4">
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="Params" class="tabcontent overflow-auto"></div>
|
|
<div id="Functions" class="tabcontent">
|
|
<!-- Custom parameters come first: they are defined here and then
|
|
consumed by the constraints below. -->
|
|
<div class="compact-settings-header"><b>Custom parameters</b></div>
|
|
<div class="compact-settings-row custom-parameter-row">
|
|
<label class="constraint-field custom-parameter-field" for="newParamName">
|
|
<span>Name</span>
|
|
<input type="text" id="newParamName" aria-label="New parameter name" placeholder="e.g. Bfield">
|
|
</label>
|
|
<button type="button" id="addParamBtn" onclick="addCustomParam();">Add</button>
|
|
<span id="customParamList" class="custom-param-list" aria-live="polite"></span>
|
|
</div>
|
|
|
|
<!-- Constraints consume the custom parameters defined above and use the
|
|
same compact section/header language as Runs, Fit model, and Fit
|
|
options. Existing control IDs are preserved so this is a
|
|
presentation cleanup rather than a change to MSR generation. -->
|
|
<div class="compact-settings-header"><b>Constraints</b></div>
|
|
<div id="funLineContainer" class="compact-settings-row constraints-options-row">
|
|
<label class="constraint-field constraint-parameter-field" for="funSel">
|
|
<span>Parameter</span>
|
|
<select id="funSel" aria-label="Constraint parameter"></select>
|
|
</label>
|
|
<label class="constraint-field constraint-expression-field" for="funLine">
|
|
<span>Function</span>
|
|
<input type="text" id="funLine" onchange="" aria-label="Function line" placeholder="e.g. 2*pi*Bfield">
|
|
</label>
|
|
<button type="button" id="addFunLine" onclick="addFunLine();">Add</button>
|
|
</div>
|
|
|
|
<!-- The generated THEORY/FUNCTIONS text is an important part of the
|
|
constraint workflow: it lets the user immediately verify how GUI
|
|
constraints translate into MSR syntax. Keep this preview permanently
|
|
visible and use the same compact section header as the editable rows. -->
|
|
<div class="compact-settings-header"><b>Preview</b></div>
|
|
<div id="constraintsPreview" class="split-panel-grid constraints-preview-grid">
|
|
<section class="code-panel">
|
|
<div class="constraint-preview-label">Theory</div>
|
|
<pre class="mono-block" contenteditable="false" id="theoFunBlock"></pre>
|
|
</section>
|
|
<section class="code-panel">
|
|
<div class="constraint-preview-label">Functions</div>
|
|
<pre class="mono-block" contenteditable="false" id="funBlock"></pre>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div id="t0Bg" class="tabcontent">
|
|
</div>
|
|
<div id="Editor" class="tabcontent">
|
|
<!-- The editor toolbar carries document selection, ownership state, and file
|
|
actions in one place. The former green "Editor" banner repeated the tab
|
|
name without adding state, so the editable text can now start immediately. -->
|
|
<div class="editor-toolbar">
|
|
<div class="editor-source-tabs" id="editorSourceTabs" aria-label="MSR editor files">
|
|
<button type="button" class="editor-source-tab active" id="btnEditorCurrent" onclick="showMSREditorSource('current');">MSR</button>
|
|
<button type="button" class="editor-source-tab" id="btnEditorTemplate" onclick="showMSREditorSource('template');" hidden>Template</button>
|
|
</div>
|
|
<span class="msr-source-state" id="msrSourceState"
|
|
role="group" aria-label="Editor ownership actions" hidden>
|
|
<span class="visually-hidden" id="msrSourceStateLabel">Editor source</span>
|
|
<button type="button" class="editor-transfer-button"
|
|
onclick="syncCurrentEditorToGUI();"
|
|
title="Copy recognized settings from this MSR into the GUI"
|
|
aria-label="Sync MSR settings to GUI">MSR → GUI</button>
|
|
</span>
|
|
<button type="button" class="editor-transfer-button"
|
|
onclick="regenerateEditorFromGUI();"
|
|
title="Replace the visible MSR with a document generated from the GUI">GUI → MSR</button>
|
|
<span class="editor-toolbar-spacer" aria-hidden="true"></span>
|
|
<button type="button" class="editor-icon-button editor-lock-button" id="msrUnlockButton"
|
|
onclick="unlockMSREditorSource();"
|
|
title="GUI controls this MSR; editing the text will lock it"
|
|
aria-label="Editor source unlocked" disabled>
|
|
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
<rect x="5" y="10" width="14" height="11" rx="2"></rect>
|
|
<path class="editor-lock-open" d="M8 10V7a4 4 0 0 1 7.6-1.8"></path>
|
|
<path class="editor-lock-closed" d="M8 10V7a4 4 0 0 1 8 0v3"></path>
|
|
</svg>
|
|
</button>
|
|
<button type="button" class="editor-icon-button"
|
|
onclick="saveCurrentMSRFile();"
|
|
title="Save the visible MSR document" aria-label="Save visible MSR document">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
<path d="M5 3h11l3 3v15H5z"></path>
|
|
<path d="M8 3v6h8V3"></path>
|
|
<path d="M8 21v-7h8v7"></path>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div class="editor-text-row">
|
|
<div class="editor-text-pane">
|
|
<pre id="msrEditorText"
|
|
class="msr-editor"
|
|
contenteditable="true"
|
|
spellcheck="false"
|
|
oninput="handleMSREditorInput();"
|
|
onkeydown="handleMSREditorKeydown(event);"
|
|
aria-label="MSR editor"></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="Jobs" class="tabcontent">
|
|
<div class="result-output">
|
|
<div id="resultArtifactEmpty" class="result-empty">No results yet.</div>
|
|
<div id="resultArtifactList" hidden>
|
|
<!-- Keep the fitted MSR immediately visible because it is the canonical
|
|
result of a fit. Generated companion artifacts, including the ROOT
|
|
canvas, remain available without competing for permanent space. -->
|
|
<div id="resultPrimaryFiles" class="result-primary-files">
|
|
<div class="result-file-row" data-artifact-row>
|
|
<span class="result-file-label">Result MSR</span>
|
|
<a id="resultMSRPath">-</a>
|
|
</div>
|
|
</div>
|
|
<details id="resultOtherFiles" class="results-details result-other-files" hidden>
|
|
<summary>Other files</summary>
|
|
<div class="result-secondary-files">
|
|
<div class="result-file-row" data-artifact-row>
|
|
<span class="result-file-label">ROOT plot</span>
|
|
<a id="resultPlotPath">-</a>
|
|
</div>
|
|
<div class="result-file-row" data-artifact-row>
|
|
<span class="result-file-label">Template MSR</span>
|
|
<a id="resultTemplatePath">-</a>
|
|
</div>
|
|
<div class="result-file-row" data-artifact-row>
|
|
<span class="result-file-label">Output log</span>
|
|
<a id="resultLogPath">-</a>
|
|
</div>
|
|
<div class="result-file-row" data-artifact-row>
|
|
<span class="result-file-label">Parameter data</span>
|
|
<a id="resultParameterDataPath">-</a>
|
|
</div>
|
|
<div class="result-file-row" data-artifact-row>
|
|
<span class="result-file-label">All files</span>
|
|
<a id="resultPackagePath">-</a>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
</div>
|
|
</div>
|
|
<details class="results-details">
|
|
<summary>Execution details</summary>
|
|
<dl class="execution-details">
|
|
<div>
|
|
<dt>Started</dt>
|
|
<dd id="jobDetailStarted">-</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Finished</dt>
|
|
<dd id="jobDetailFinished">-</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Exit code</dt>
|
|
<dd id="jobDetailExitCode">-</dd>
|
|
</div>
|
|
<div class="execution-detail-wide">
|
|
<dt>GUI parameter synchronization</dt>
|
|
<dd id="resultParameterSync">-</dd>
|
|
</div>
|
|
</dl>
|
|
</details>
|
|
<section class="results-details jobs-log-wrap" aria-label="Command log">
|
|
<div class="results-log-heading">Command log</div>
|
|
<pre class="job-log" id="jobLogText">No job has been started.</pre>
|
|
</section>
|
|
</div>
|
|
|
|
<!-- Quick Start is modeless in the browser. The same standalone help
|
|
document is loaded in an independent BrowserWindow by Electron. -->
|
|
<dialog id="quickStartDialog" class="web-plot-window quick-start-dialog"
|
|
aria-label="muSRFlow Quick Start" aria-modal="false">
|
|
<div class="web-plot-header">
|
|
<div class="web-plot-drag-handle"><strong>muSRFlow Quick Start</strong></div>
|
|
<div class="web-plot-controls">
|
|
<button type="button" onclick="closeQuickStartHelp();" title="Close help"
|
|
aria-label="Close help">×</button>
|
|
</div>
|
|
</div>
|
|
<iframe id="quickStartFrame" class="quick-start-frame" title="muSRFlow Quick Start"></iframe>
|
|
</dialog>
|
|
|
|
<!-- Quick explanation for the compact status bar. Results keeps the same
|
|
command log as the persistent record. -->
|
|
<dialog id="jobLogWindow" class="web-plot-window job-log-window" aria-label="Run log"
|
|
onclose="setJobLogExpanded(false);">
|
|
<div class="web-plot-header">
|
|
<div class="web-plot-drag-handle"><strong>Run log</strong></div>
|
|
<div class="web-plot-controls">
|
|
<button type="button" onclick="closeJobLogWindow();" title="Close log"
|
|
aria-label="Close log">×</button>
|
|
</div>
|
|
</div>
|
|
<pre class="job-log job-log-popup" id="jobLogPopupText">No job has been started.</pre>
|
|
</dialog>
|
|
|
|
<!-- Action-blocking errors require acknowledgement, but the verbose command
|
|
output remains optional through the run-log button. -->
|
|
<dialog id="jobOutcomeDialog" class="job-outcome-dialog"
|
|
aria-labelledby="jobOutcomeTitle" aria-describedby="jobOutcomeSummary">
|
|
<form method="dialog" class="job-outcome-content">
|
|
<div class="job-outcome-header">
|
|
<strong id="jobOutcomeTitle">Action could not be completed</strong>
|
|
<button type="submit" class="job-outcome-close" title="Close notice"
|
|
aria-label="Close notice">×</button>
|
|
</div>
|
|
<p id="jobOutcomeSummary"></p>
|
|
<pre id="jobOutcomeDetails" class="job-outcome-details" hidden></pre>
|
|
<div class="job-outcome-actions">
|
|
<button type="button"
|
|
onclick="document.getElementById('jobOutcomeDialog').close();showJobLogWindow();">Open run log</button>
|
|
<button type="submit">Close</button>
|
|
</div>
|
|
</form>
|
|
</dialog>
|
|
|
|
<!-- Independent-series fits summarize as worst/best in the status bar;
|
|
this dialog shows every run's statistic, converged state, and file. -->
|
|
<dialog id="seriesStatisticDialog" class="series-statistic-dialog"
|
|
aria-labelledby="seriesStatisticTitle">
|
|
<div class="web-plot-header">
|
|
<div class="web-plot-drag-handle"><strong id="seriesStatisticTitle">Series statistics</strong></div>
|
|
<div class="web-plot-controls">
|
|
<button type="button"
|
|
onclick="document.getElementById('seriesStatisticDialog').close();"
|
|
title="Close statistics" aria-label="Close statistics">×</button>
|
|
</div>
|
|
</div>
|
|
<table class="series-statistic-table">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Run</th>
|
|
<th scope="col">Action</th>
|
|
<th scope="col">Statistic</th>
|
|
<th scope="col">Converged</th>
|
|
<th scope="col">File</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="seriesStatisticTable"></tbody>
|
|
</table>
|
|
</dialog>
|
|
|
|
<!-- Electron imports the same portable state fragment produced by the
|
|
web Share button without navigating away from the local application. -->
|
|
<dialog id="sharedConfigurationDialog" class="shared-configuration-dialog"
|
|
aria-labelledby="sharedConfigurationTitle">
|
|
<form class="shared-configuration-form"
|
|
onsubmit="event.preventDefault();restoreElectronSharedConfiguration();">
|
|
<div class="shared-configuration-header">
|
|
<strong id="sharedConfigurationTitle">Restore configuration link</strong>
|
|
</div>
|
|
<p class="shared-configuration-help">
|
|
Paste a muSRFlow link. Analysis settings will be restored while local
|
|
data and working directories remain unchanged.
|
|
</p>
|
|
<label class="settings-field" for="sharedConfigurationURL">
|
|
<span>Configuration link</span>
|
|
<textarea id="sharedConfigurationURL" rows="4" spellcheck="false"
|
|
placeholder="http://musruser.psi.ch/muSRFlow/#c=..."></textarea>
|
|
</label>
|
|
<p id="sharedConfigurationError" class="shared-configuration-error"
|
|
role="alert" hidden></p>
|
|
<div class="shared-configuration-actions">
|
|
<button type="button"
|
|
onclick="document.getElementById('sharedConfigurationDialog').close();">Cancel</button>
|
|
<button type="submit">Restore</button>
|
|
</div>
|
|
</form>
|
|
</dialog>
|
|
|
|
<!-- Electron-only session saving. The label is stored with the state
|
|
fragment so a session can be found by its human-readable name. -->
|
|
<dialog id="saveSessionDialog" class="shared-configuration-dialog"
|
|
aria-labelledby="saveSessionTitle">
|
|
<form class="shared-configuration-form"
|
|
onsubmit="event.preventDefault();writeElectronSession();">
|
|
<div class="shared-configuration-header">
|
|
<strong id="saveSessionTitle">Save session</strong>
|
|
</div>
|
|
<p class="shared-configuration-help">
|
|
Save the current analysis settings into
|
|
<code>musrflow-sessions.txt</code> in the working directory so they
|
|
can be restored later, even after the application restarts.
|
|
</p>
|
|
<label class="settings-field" for="sessionLabel">
|
|
<span>Session label</span>
|
|
<input type="text" id="sessionLabel" maxlength="200" spellcheck="false"
|
|
placeholder="e.g. Fe calibration, run 514">
|
|
</label>
|
|
<p id="saveSessionError" class="shared-configuration-error"
|
|
role="alert" hidden></p>
|
|
<div class="shared-configuration-actions">
|
|
<button type="button"
|
|
onclick="document.getElementById('saveSessionDialog').close();">Cancel</button>
|
|
<button type="submit">Save</button>
|
|
</div>
|
|
</form>
|
|
</dialog>
|
|
|
|
<!-- Electron-only session restore. The journal lists every saved session
|
|
with its label and timestamp; picking one restores through the same
|
|
decode/restore path as a pasted configuration link. -->
|
|
<dialog id="sessionHistoryDialog" class="shared-configuration-dialog session-history-dialog"
|
|
aria-labelledby="sessionHistoryTitle">
|
|
<div class="shared-configuration-form">
|
|
<div class="shared-configuration-header">
|
|
<strong id="sessionHistoryTitle">Restore session</strong>
|
|
</div>
|
|
<p class="shared-configuration-help">
|
|
Choose a saved session. Its analysis settings are restored while
|
|
local data and working directories remain unchanged.
|
|
</p>
|
|
<label class="settings-field" for="sessionHistoryList">
|
|
<span>Previously saved sessions</span>
|
|
<select id="sessionHistoryList" size="8" class="session-history-list"
|
|
aria-label="Previously saved sessions"></select>
|
|
</label>
|
|
<p id="sessionHistoryError" class="shared-configuration-error"
|
|
role="alert" hidden></p>
|
|
<div class="shared-configuration-actions">
|
|
<button type="button"
|
|
onclick="document.getElementById('sessionHistoryDialog').close();">Cancel</button>
|
|
<button type="button" onclick="restoreSelectedSession();">Restore</button>
|
|
</div>
|
|
</div>
|
|
</dialog>
|
|
|
|
<!-- Electron-only application settings. The web deployment gets both
|
|
directories from server configuration and never exposes this dialog. -->
|
|
<dialog id="preferencesDialog" class="preferences-dialog" aria-labelledby="preferencesTitle">
|
|
<form method="dialog" class="preferences-form">
|
|
<div class="preferences-header">
|
|
<strong id="preferencesTitle">Preferences</strong>
|
|
</div>
|
|
<label class="settings-field" for="workPath">
|
|
<span>Work directory</span>
|
|
<div class="preferences-path-row">
|
|
<input type="text" id="workPath" value=".">
|
|
<button type="button" onclick="selectWorkFolder();">Browse...</button>
|
|
</div>
|
|
</label>
|
|
<label class="settings-field" for="dataRoot">
|
|
<span>Data directory</span>
|
|
<div class="preferences-path-row">
|
|
<input type="text" id="dataRoot" value="/psi.ch/group/lmu/public/data">
|
|
<button type="button" id="dataRootBrowse" onclick="selectDataRootFolder();">Browse...</button>
|
|
</div>
|
|
<span class="preferences-hint" id="runDataDownloadHint">Missing run files can be downloaded from musruser.psi.ch. Read-only directories use a personal data folder.</span>
|
|
</label>
|
|
<label class="settings-field" for="startupXml">
|
|
<span>musrfit startup XML</span>
|
|
<div class="preferences-path-row">
|
|
<input type="text" id="startupXml" value="" placeholder="auto-detect">
|
|
<button type="button" id="startupXmlBrowse" onclick="selectStartupXmlFile();">Browse...</button>
|
|
</div>
|
|
<span class="preferences-hint" id="startupNamingStatus"></span>
|
|
</label>
|
|
<label class="settings-field" for="binDir">
|
|
<span>musrfit binaries</span>
|
|
<div class="preferences-path-row">
|
|
<input type="text" id="binDir" value="" placeholder="auto-detect">
|
|
<button type="button" id="binDirBrowse" onclick="selectBinFolder();">Browse...</button>
|
|
</div>
|
|
<span class="preferences-hint">Directory holding musrfit, musrview, msr2data and dump_header</span>
|
|
</label>
|
|
<div id="localRuntimeControls" hidden>
|
|
<div class="runtime-setup-actions">
|
|
<button type="button" id="runtimeCheck" title="Checks the saved binaries setting; save folder changes first." onclick="checkElectronRuntime();">Check tools</button>
|
|
<button type="button" id="runtimeInstall" onclick="installElectronRuntime();">Install runtime...</button>
|
|
<button type="button" id="runtimeCancel" onclick="cancelElectronRuntimeInstall();" hidden>Cancel installation</button>
|
|
</div>
|
|
<span class="preferences-hint" id="localRuntimeStatus" role="status" aria-live="polite">Use an existing installation, or install a local runtime download bundle.</span>
|
|
</div>
|
|
<label class="settings-field" for="musrfitThreads">
|
|
<span>musrfit threads</span>
|
|
<input type="number" id="musrfitThreads" min="1" step="1" value="" placeholder="all cores">
|
|
<span class="preferences-hint" id="musrfitThreadsHint">OpenMP threads passed to musrfit (<code>-u</code>). Leave blank to use all cores.</span>
|
|
</label>
|
|
<div class="preferences-section-title">Initial parameters</div>
|
|
<label class="preferences-check-row" for="guessInitialParameters">
|
|
<input type="checkbox" id="guessInitialParameters" checked>
|
|
<span>Guess initial parameters from first-run header</span>
|
|
</label>
|
|
<label class="preferences-check-row" for="estimateT0FromPromptPeak">
|
|
<input type="checkbox" id="estimateT0FromPromptPeak" checked>
|
|
<span>Estimate t0 from the prompt peak (except LEM/HAL)</span>
|
|
</label>
|
|
<span class="preferences-hint" id="estimateT0FromPromptPeakHint">Before a local fit, run <code>musrt0 --getT0FromPromptPeak</code> so t0 is written from the histogram peak. Never applied to LEM or HAL/HIFI data.</span>
|
|
<div class="preferences-section-title">Output file suffixes</div>
|
|
<div class="settings-grid settings-grid-2 preferences-suffix-grid">
|
|
<label class="settings-field" for="asymmetrySuffix">
|
|
<span>Asymmetry</span>
|
|
<input type="text" id="asymmetrySuffix" value="_asy">
|
|
</label>
|
|
<label class="settings-field" for="singleHistSuffix">
|
|
<span>Single histogram</span>
|
|
<input type="text" id="singleHistSuffix" value="_singleHist">
|
|
</label>
|
|
</div>
|
|
<div class="preferences-actions">
|
|
<button type="button" onclick="cancelElectronPreferences();">Cancel</button>
|
|
<button type="button" onclick="saveElectronPreferences();">Save</button>
|
|
</div>
|
|
<span id="dataRootModeText" hidden></span>
|
|
</form>
|
|
</dialog>
|
|
</div>
|
|
</main>
|
|
<!-- Keep persistent status terse: state is always visible, while
|
|
fit quality/message/file/directory appear only when they add context. -->
|
|
<div id="appStatusBar" class="app-status-bar" data-state="idle">
|
|
<button type="button" class="status-state status-log-button status-state-button"
|
|
id="jobStatusState" onclick="showJobLogWindow();"
|
|
aria-controls="jobLogWindow" aria-haspopup="dialog" aria-expanded="false" disabled>Idle</button>
|
|
<!-- Fit quality comes from musrfit's STATISTIC block and is kept separate
|
|
from transient process messages such as musrview completion. For a
|
|
series it is the worst/best aggregate; click it for the per-run table. -->
|
|
<button type="button" class="status-statistic status-state-button"
|
|
id="jobStatusStatistic" onclick="showSeriesStatisticsDialog();"
|
|
aria-haspopup="dialog" hidden></button>
|
|
<button type="button" class="status-message status-log-button status-message-button"
|
|
id="jobStatusMessage" onclick="showJobLogWindow();"
|
|
aria-controls="jobLogWindow" aria-haspopup="dialog" aria-expanded="false" hidden></button>
|
|
<span class="status-file" id="jobStatusFile" hidden></span>
|
|
<span class="status-directory" id="jobStatusDirectory" hidden></span>
|
|
<span class="visually-hidden" id="jobStatusAnnouncement"
|
|
role="status" aria-live="polite" aria-atomic="true"></span>
|
|
</div>
|
|
</body>
|
|
<script>
|
|
// Setup max and min year
|
|
let e = document.getElementById("selYear");
|
|
let currYear = new Date().getFullYear();
|
|
e.max = currYear;
|
|
e.min = 1998;
|
|
e.value = currYear;
|
|
|
|
// Open the default Runs tab
|
|
if (!amIWeb()) {
|
|
document.body.classList.add("electron-shell");
|
|
const saveSessionButton = document.getElementById("saveSessionButton");
|
|
if (saveSessionButton) saveSessionButton.hidden = false;
|
|
} else {
|
|
const desktopLinkButton = document.getElementById("desktopLinkButton");
|
|
if (desktopLinkButton) desktopLinkButton.hidden = false;
|
|
}
|
|
|
|
document.getElementById("btnRuns").click();
|
|
initRunModeStatus();
|
|
|
|
if (!amIWeb()) {
|
|
// Register Electron IPC handlers for the File menu and Preferences.
|
|
firstLoad();
|
|
}
|
|
</script>
|
|
</html>
|