\(\renewcommand\AA{\unicode{x212B}}\)

Fitting Models To Data

Fitting is iteratively searching for the parameter values that minimise some cost function to obtain the best fit of the model to the data.

In summary the Mantid fitting provides

  • General fitting capabilities
  • Fitting extras, that make use of data log file and instrument geometry information to enhance the user fitting experience
  • Easily expandable

Here we will cover the basic mantid fitting capabilities.

Simple fitting

  1. Plot the only spectrum in the data set MUSR00015189_cropped.nxs

MUSRDataSet.png

  1. Select the Toolbar button to open Fit Property Browser: PeakFitToolbar.png

MUSRDataSetFittingOn.png

  1. Right click on the plot and select “Add other function”

AddOtherFunctionOption.png

4. Choose ExpDecay and click OK ChooseExpDecay.png

5. Notice how the ExpDecay function has appeared in the Functions list on the Fit Property Browser, and there are pre-set Settings below. For now, just click on the drop-down menu “Fit” and run a normal Fit.

RunFitOption
  1. Examine the results…

Fit results

After a successful fit the results can be examined in three ways.

  1. A plot of the fitted model will be added to the graph which now shows the Original data, the Calculated fit and the Difference between them.
  2. The Fit Function property browser will show the fitted parameters instead of their initial values. If you click on the triangle beside fo-ExpDecay in the Functions list, it will reveal the Output fit parameters (Height and Lifetime values). Also the Chi-Squared value is displayed at the top of the Fitting tab.

MUSRDataSetFittingResults.png

  1. Output workspaces will be created and available via the main Mantid Workspaces Toolbox:
FitResults.png

There are three output workspaces:

1. A TableWorkspace with the name suffixed with “_Parameters”. It contains the fitting parameters and their corresponding errors.

ParametersTable.png

2. A MatrixWorkspace with the name suffixed with “_Workspace”. Its first three spectra are: the original data, the calculated model, and the difference.

FitResultWorkspace.png

3. Another TableWorkspace with the name suffixed with “_NormalisedCovarianceMatrix”. It contains the variance-covariance matrix normalized to 100.

Covariance Table