Files

58 lines
2.1 KiB
ReStructuredText

Constraints
===========
The **Constraints** tab adds fit functions and parameter relations that are
not represented by the main theory controls. It is split into three parts:
* **Custom parameters** -- the named constants you define once and reference
from constraints.
* **Constraints** -- one row per constraint: a parameter, a function
expression, and an Add button.
* **Preview** -- a live read-only rendering of the ``THEORY`` and
``FUNCTIONS`` blocks that the MSR will contain.
Everything on this tab is included the next time the MSR is generated, so you
can refine the preview without running musrfit.
Custom parameters
-----------------
Type a name (for example ``Bfield``) and press **Add**. Custom parameters
become available on the parameters list and can be referenced by constraints
like any ordinary fit parameter. They are removed by the same workflow that
removes a normal model parameter.
Constraints
-----------
A constraint binds the value of one parameter to an expression of others.
To add one:
#. Choose the parameter to constrain from the **Parameter** dropdown.
#. Type the expression into the **Function** field.
#. Press **Add**.
The expression uses musrfit ``FUNCTIONS`` syntax: arithmetic on parameter
names and literals.
Example: couple the magnetic field to the Larmor frequency
-------------------------------------------------------------
A typical use is to avoid fitting a frequency directly and instead fit an
applied field:
#. Add a custom parameter named ``Bfield`` under **Custom parameters**.
#. Under **Constraints**, choose ``Frq`` from the **Parameter** dropdown.
#. Type ``gamma_mu * Bfield`` into the **Function** field and press **Add**.
The constraint reads "the Larmor frequency ``Frq`` equals the muon gyromagnetic
ratio multiplied by ``Bfield``". The theory and functions preview updates
immediately so you can verify the generated ``FUNCTIONS`` text before fitting.
Preview
-------
The **Theory** and **Functions** panes show exactly what the MSR will
contain. The Theory pane reflects the model components from the Runs tab; the
Functions pane reflects the constraints. Both are read-only -- use the GUI
controls to change them.