Files
muSRFlow/docs/_build/html/lem2025-singlehist-example.html

262 lines
20 KiB
HTML

<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LEM single-histogram example &mdash; muSRFlow User Manual</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=d11f710b" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=8085e645"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Constraints" href="constraints.html" />
<link rel="prev" title="Parameters and parameter plots" href="parameters-plots.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
muSRFlow
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="getting-started.html">Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="install-windows.html">Windows installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="install-linux.html">Linux installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="runs-fitting.html">Runs and fitting</a></li>
<li class="toctree-l1"><a class="reference internal" href="parameters-plots.html">Parameters and parameter plots</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">LEM single-histogram example</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#data-and-model">Data and model</a></li>
<li class="toctree-l2"><a class="reference internal" href="#inspect-the-fitted-run">Inspect the fitted run</a></li>
<li class="toctree-l2"><a class="reference internal" href="#compare-the-energy-scans">Compare the energy scans</a></li>
<li class="toctree-l2"><a class="reference internal" href="#reproduce-and-inspect">Reproduce and inspect</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="constraints.html">Constraints</a></li>
<li class="toctree-l1"><a class="reference internal" href="t0-background.html">t0 / background</a></li>
<li class="toctree-l1"><a class="reference internal" href="msr-editor.html">MSR editor</a></li>
<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"><a class="reference internal" href="platforms.html">Web and desktop editions</a></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>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">muSRFlow</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">LEM single-histogram example</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/lem2025-singlehist-example.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="lem-single-histogram-example">
<h1>LEM single-histogram example<a class="headerlink" href="#lem-single-histogram-example" title="Link to this heading"></a></h1>
<p>This worked example repeats the LEM 2025 energy scans using <strong>single-histogram
fits</strong>, not asymmetry fits. The original files in <code class="docutils literal notranslate"><span class="pre">/tmp/lemfit</span></code> were
asymmetry fits and were used only for initial parameter estimates. They were
not overwritten.</p>
<section id="data-and-model">
<h2>Data and model<a class="headerlink" href="#data-and-model" title="Link to this heading"></a></h2>
<ul class="simple">
<li><p><strong>Data set 1:</strong> runs <strong>1014-1027</strong>, 3.8 K, blue circles.</p></li>
<li><p><strong>Data set 2:</strong> runs <strong>1033-1045</strong>, 10 K, red squares.</p></li>
<li><p>Sample: 85 nm Nb/Al2O3; nominal field 100 G; energy approximately 1-18 keV.</p></li>
<li><p>Fit type: <strong>Single histogram</strong> (<code class="docutils literal notranslate"><span class="pre">fittype</span> <span class="pre">0</span></code>), groups <code class="docutils literal notranslate"><span class="pre">21</span> <span class="pre">25</span></code> and
<code class="docutils literal notranslate"><span class="pre">23</span> <span class="pre">27</span></code>; nominal fit interval <strong>0-8 microseconds</strong>, packing <strong>100</strong>.</p></li>
</ul>
<p>Both count-histogram groups are fitted together for each physical run.
The polarization model is</p>
<div class="math notranslate nohighlight">
\[P_j(t) = A_0 \exp[-(\sigma t)^2/2]
\cos(2\pi\gamma_\mu B t + \phi_j).\]</div>
<p>The MSR theory is <code class="docutils literal notranslate"><span class="pre">asymmetry</span></code>, <code class="docutils literal notranslate"><span class="pre">simpleGss</span></code>, <code class="docutils literal notranslate"><span class="pre">TFieldCos</span></code> with
<code class="docutils literal notranslate"><span class="pre">fun1</span> <span class="pre">=</span> <span class="pre">gamma_mu</span> <span class="pre">*</span> <span class="pre">par3</span></code>, where parameter 3 is <code class="docutils literal notranslate"><span class="pre">Bfield</span></code>. Thus field is
fitted directly in G, rather than converted from a plotted frequency later.
<code class="docutils literal notranslate"><span class="pre">Sgm</span></code> is in inverse microseconds and <code class="docutils literal notranslate"><span class="pre">Asy</span></code> is dimensionless.</p>
<p>Each group has its own phase, normalization and constant background.
<code class="docutils literal notranslate"><span class="pre">Asy</span></code>, <code class="docutils literal notranslate"><span class="pre">Sgm</span></code> and <code class="docutils literal notranslate"><span class="pre">Bfield</span></code> are common to the two groups <strong>within one
physical run</strong>. No parameters are shared <strong>between physical runs</strong>: these
are 27 independent fits, not one global fit across the energy scan.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>No <code class="docutils literal notranslate"><span class="pre">musrt0</span> <span class="pre">-g</span></code> correction or explicit t0/data override was applied.
musrfit reads the LEM timing information and reports its automatic data
range fallback (start t0 + 51 bins, end 66601). The nominal interval is
0-8 microseconds; the fallback excludes approximately the first 10 ns.
The retained command logs record these warnings.</p>
</div>
</section>
<section id="inspect-the-fitted-run">
<h2>Inspect the fitted run<a class="headerlink" href="#inspect-the-fitted-run" title="Link to this heading"></a></h2>
<p>The screenshots below show the actual application after importing the fitted
<code class="docutils literal notranslate"><span class="pre">1014_his.msr</span></code>. The fits themselves were executed with the command-line
script described below; the screenshots do not imply a browser fit job was
executed. Importing this file also restores its recognized GUI settings.</p>
<figure class="align-default" id="id1">
<a class="reference internal image-reference" href="_images/lem2025-singlehist-runs.png"><img alt="Runs tab populated from the fitted LEM 2025 single-histogram MSR." src="_images/lem2025-singlehist-runs.png" style="width: 100%;" />
</a>
<figcaption>
<p><span class="caption-text">Representative run 1014. Use this fit type, histogram grouping and model
for the two run ranges. Leave cross-run Shared parameters unchecked.</span><a class="headerlink" href="#id1" title="Link to this image"></a></p>
</figcaption>
</figure>
<figure class="align-default" id="id2">
<a class="reference internal image-reference" href="_images/lem2025-singlehist-parameters.png"><img alt="Parameter table imported from the completed single-histogram fit of run 1014." src="_images/lem2025-singlehist-parameters.png" style="width: 100%;" />
</a>
<figcaption>
<p><span class="caption-text">Fitted parameters imported from run 1014, not illustrative starting values.
The two groups have independent nuisance parameters.</span><a class="headerlink" href="#id2" title="Link to this image"></a></p>
</figcaption>
</figure>
<figure class="align-default" id="id3">
<a class="reference internal image-reference" href="_images/lem2025-singlehist-editor.png"><img alt="Highlighted fitted MSR for LEM run 1014 in the application editor." src="_images/lem2025-singlehist-editor.png" style="width: 100%;" />
</a>
<figcaption>
<p><span class="caption-text">The fitted MSR is the authoritative record. Editor ownership preserves
the imported text rather than regenerating it from an approximate model.</span><a class="headerlink" href="#id3" title="Link to this image"></a></p>
</figcaption>
</figure>
<figure class="align-default" id="id4">
<a class="reference internal image-reference" href="_images/lem2025-singlehist-spectrum.png"><img alt="musrview plot of the two fitted histogram groups of LEM run 1014." src="_images/lem2025-singlehist-spectrum.png" style="width: 100%;" />
</a>
<figcaption>
<p><span class="caption-text">Actual <code class="docutils literal notranslate"><span class="pre">musrview</span> <span class="pre">1014_his.msr</span> <span class="pre">--png</span></code> output. <code class="docutils literal notranslate"><span class="pre">PLOT</span> <span class="pre">0</span></code> contains
<code class="docutils literal notranslate"><span class="pre">runs</span> <span class="pre">1</span> <span class="pre">2</span></code> and <code class="docutils literal notranslate"><span class="pre">lifetimecorrection</span></code>; both histogram groups are shown.</span><a class="headerlink" href="#id4" title="Link to this image"></a></p>
</figcaption>
</figure>
</section>
<section id="compare-the-energy-scans">
<h2>Compare the energy scans<a class="headerlink" href="#compare-the-energy-scans" title="Link to this heading"></a></h2>
<ol class="arabic simple">
<li><p>Fit each run range independently and export one parameter table per scan.
The supplied <code class="docutils literal notranslate"><span class="pre">dataset1.dat</span></code> and <code class="docutils literal notranslate"><span class="pre">dataset2.dat</span></code> contain the new fits.</p></li>
<li><p>Open <strong>Parameter plots</strong>, load the first table and add the second as an
overlay. Select <code class="docutils literal notranslate"><span class="pre">dataE</span></code> (implantation energy in keV) for X.</p></li>
<li><p>Use a <strong>3 x 1</strong> layout, with <code class="docutils literal notranslate"><span class="pre">Bfield</span></code>, <code class="docutils literal notranslate"><span class="pre">Sgm</span></code> and <code class="docutils literal notranslate"><span class="pre">Asy</span></code> in separate
panels. Overlay both data sets in every panel.</p></li>
<li><p>Set data set 1 blue and data set 2 red using the marker style editor’s
<strong>This data set</strong> scope. Keep error bars enabled. Resize the plot window
to give each panel approximately 4:3 proportions.</p></li>
</ol>
<figure class="align-default" id="id5">
<a class="reference internal image-reference" href="_images/lem2025-singlehist-comparison.png"><img alt="Actual application plot of field, Gaussian sigma and initial asymmetry against energy with blue and red data sets and error bars." src="_images/lem2025-singlehist-comparison.png" style="width: 75%;" />
</a>
<figcaption>
<p><span class="caption-text">Actual muSRFlow parameter-plot window, using the newly exported tables.
Error bars are the HESSE parameter uncertainties exported by msr2data.</span><a class="headerlink" href="#id5" title="Link to this image"></a></p>
</figcaption>
</figure>
<p>All 27 fits produced finite parameters and positive uncertainties for the
three plotted quantities. Reduced chi-square ranges from <strong>0.933 to 2.003</strong>
(809 degrees of freedom per fit). In particular, the lowest-energy fit is
not statistically ideal: successful minimization does not establish that
one Gaussian cosine fully describes the data. Inspect residuals and fit
range dependence before drawing quantitative physical conclusions.</p>
</section>
<section id="reproduce-and-inspect">
<h2>Reproduce and inspect<a class="headerlink" href="#reproduce-and-inspect" title="Link to this heading"></a></h2>
<p>The repository directory <code class="docutils literal notranslate"><span class="pre">docs/examples/lem2025-singlehist-energy-scan</span></code>
contains all 27 fitted MSRs, their starting-file backups and logs, raw and
normalized msr2data tables, metadata, a fit summary and the fit script.
Raw detector data are not included. The summary records their SHA256 hashes.
The documented run used musrfit 1.12.1 with ROOT 6.38.00.</p>
<p>From the repository root, with musrfit, msr2data and dump_header on PATH:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="n">docs</span><span class="o">/</span><span class="n">examples</span><span class="o">/</span><span class="n">lem2025</span><span class="o">-</span><span class="n">singlehist</span><span class="o">-</span><span class="n">energy</span><span class="o">-</span><span class="n">scan</span><span class="o">/</span><span class="n">fit_all</span><span class="o">.</span><span class="n">py</span> \
<span class="o">--</span><span class="n">data</span><span class="o">-</span><span class="nb">dir</span> <span class="o">/</span><span class="n">mnt</span><span class="o">/</span><span class="n">data</span><span class="o">/</span><span class="n">nemu</span><span class="o">/</span><span class="n">his</span><span class="o">/</span><span class="mi">2025</span> \
<span class="o">--</span><span class="n">work</span><span class="o">-</span><span class="nb">dir</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">lem</span><span class="o">-</span><span class="n">singlehist</span><span class="o">-</span><span class="n">new</span> \
<span class="o">--</span><span class="n">reference</span><span class="o">-</span><span class="nb">dir</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">lemfit</span>
</pre></div>
</div>
<p>Use your own data directory containing <code class="docutils literal notranslate"><span class="pre">lem25_his_1014.root</span></code> etc. Choose
an empty work directory; existing results are not overwritten. The optional
reference directory supplies starting values only. Without it, the script
uses documented generic initial values, which need not reproduce the same
minimum in every case.</p>
<p>The fit commands are <code class="docutils literal notranslate"><span class="pre">musrfit</span> <span class="pre">RUN_his.msr</span> <span class="pre">-e</span> <span class="pre">-t</span> <span class="pre">-u</span> <span class="pre">2</span> <span class="pre">-k</span></code>; each MSR contains
<code class="docutils literal notranslate"><span class="pre">MINIMIZE</span></code>, <code class="docutils literal notranslate"><span class="pre">HESSE</span></code> and <code class="docutils literal notranslate"><span class="pre">SAVE</span></code>. The export commands use
<code class="docutils literal notranslate"><span class="pre">msr2data</span> <span class="pre">&quot;[RUN</span> <span class="pre">...]&quot;</span> <span class="pre">_his</span> <span class="pre">data</span> <span class="pre">new</span> <span class="pre">-o</span> <span class="pre">datasetN.raw.dat</span></code>. Only run suffixes
in column headings are removed in <code class="docutils literal notranslate"><span class="pre">datasetN.dat</span></code> so both scans have matching
parameter names; numerical values and uncertainties are unchanged.</p>
<p>Download the tables used in the comparison:
<a class="reference download internal" download="" href="_downloads/19cfe0c5dfe2336636ff37c7a468815d/dataset1.dat"><code class="xref download docutils literal notranslate"><span class="pre">data</span> <span class="pre">set</span> <span class="pre">1</span></code></a>
and <a class="reference download internal" download="" href="_downloads/1043e26aaf913ce8b3037776bbba147c/dataset2.dat"><code class="xref download docutils literal notranslate"><span class="pre">data</span> <span class="pre">set</span> <span class="pre">2</span></code></a>.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="parameters-plots.html" class="btn btn-neutral float-left" title="Parameters and parameter plots" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="constraints.html" class="btn btn-neutral float-right" title="Constraints" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2026 Zaher Salman.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>