qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec.models.Model. set_fix  (  i ,  fix ,  force=False  )[source]

Set a specific parameter fix state. The fix state can be

  • a bool, whether the parameter is fixed (True) or varied (False) in a fit.
  • a positive float $\sigma$, to vary the parameter with a Gaussian prior with the standard deviation $\sigma$ around its current value. 0 or negative values fix the parameter, inf varies it freely.
  • a str "val(unc)", e.g., "1.5(0.2)", to vary the parameter with a Gaussian prior with mean val and standard deviation unc.
  • any other str, an expression of the other parameter names, e.g., "2 * Al", that defines the value of the parameter. The parameter is not varied in a fit.
  • a list [lower, upper], to vary the parameter within the bounds. An empty list is equivalent to [0, 1], a list with a single value to [0, upper].

Invalid expressions and expressions that form loops are rejected with a printed message.

Parameters:
iint_like | str

The index (int) or the name (str) of the parameter.

fixfix_type

The new fix state of the parameter.

forcebool

Force the parameter to take exactly the new fix state. If False, the parameter is converted to the correct format.

Raises:
ValueError

If fix has the wrong format.