Files
muSRFlow/docs/source/constraints.rst

2.1 KiB

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:

  1. Choose the parameter to constrain from the Parameter dropdown.
  2. Type the expression into the Function field.
  3. 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:

  1. Add a custom parameter named Bfield under Custom parameters.
  2. Under Constraints, choose Frq from the Parameter dropdown.
  3. 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.