Peak Fit

Fit data to a composite peak model.

Inputs

  • Data: Input data set

Outputs

  • Fit Parameters: Best fit values for the model parameters
  • Fits: Total evaluated best fit
  • Residuals: Difference between Fits and Data
  • Data: Input data set annotated with Fit Parameters

The Peak Fit widget computes the least-squares minimization curve fit for arbitrary, user-defined composite peak models. It outputs the best fit parameters for the defined model and the resulting total fit.

  1. Add a model component from the dropdown menu.
  2. Input model initial parameters and constraints.
  3. Visualize the initial peak and peak color.
  4. Select subsample of data for preview fit calculation.
  5. Preview plot of fit results for subsample. Center line of selected model is visualized along with the fit results for the selected curve:
    • Black dash: selected curve
    • Red line: total fit
    • Colored line: individual component fit
    • Colored dash: individual component initial values
    • Light black: other subsample spectra which can be selected
  6. Commit to start fit calculation on entire dataset.

Models and Parameters

The Peak Fit widget uses the excellent lmfit package for model definitions and non-linear optimization calculations.

The varied model parameters are specific to the model, however each peak-like model includes at least:

  • center: the centroid x value of the peak
  • amplitude: multiplicative factor for peak strength or area
  • sigma: the characteristic width of the peak

The following models are available:

Some baseline models are included, however preprocessing baselines (in Preprocess Spectra) reduces the number of varied parameters in the model and may improve fitting performance.

Constraints

Each of the varied parameters can have constraints applied to improve fitting performance.

The type of constraints can be:

  • fixed: The parameter is not varied
  • limits: Specified minimum and maximum values
  • delta: Minimum and maximum values are set to the initial value ± the delta value.
  • expr: Some models default to calculating a parameter from another parameter. It is not possible to input custom expressions.

Common uses of these constraints would be:

  • Limiting the center position to some range of x values
  • Setting a minimum amplitude to force positive peaks
  • Setting a maximum sigma to exclude unreasonably wide peaks