\(\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¶
Plot the only spectrum in the data set MUSR00015189_cropped.nxs
Select the Toolbar button to open Fit Property Browser:
Right click on the plot and select “Add other function”
4. Choose ExpDecay and click OK
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.
Examine the results…
Fit results¶
After a successful fit the results can be examined in three ways.
A plot of the fitted model will be added to the graph that now shows the Original data, the Calculated fit and the Difference between them.
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.
Output workspaces will be created and available via the main Mantid Workspaces Toolbox:
There are three output workspaces:
1. A TableWorkspace with the name suffixed with “_Parameters”. It contains the fitting parameters and their corresponding errors.
2. A MatrixWorkspace with the name suffixed with “_Workspace”. Its first three spectra are: the original data, the calculated model, and the difference.
3. Another TableWorkspace with the name suffixed with “_NormalisedCovarianceMatrix”. It contains the variance-covariance matrix normalized to 100.