Exercises

Exercise 1

In this exercise we will fit a simple Gaussian on a linear background.

  1. Start with loading the data set (GEM38370_Focussed).

  2. Plot spectrum 4.

  3. Zoom into the peak around 5 angstroms.

    GemSinglePeak.png

  4. Start the fitting tool.

  5. Adjust the fitting range if needed.

  6. Make sure the fitting model is empty in the Fit Function browser. If necessary clear it.

    ClearModel.png

  7. Add a background function. Select LinearBackground.

    AddBackgroundOption.png

  8. Add a peak. Select Gaussian.

  9. Click at peak’s maximum point to set initial values for the centre and the height.

  10. Adjust the width.

    PreparedToFitGaussian.png

  11. Run Fit.

    FittedGaussian.png

Exercise 2

This exercise will mainly quiz about fitting.

  1. Ensure that the Fit Function panel is clear using panel option Setup->’Clear model’

  2. Load the GEM63437_focussed.nxs data. Note the workspace created is a WorkspaceGroup. This is simply a containing workspace grouping one of more other workspaces. This dataset has been proceed already with Mantid. How many algorithms have been applied to this processed dataset?

  3. Plot the spectrum in GEM63437_focussed_2, and zoom in on the area of the three peaks

  4. Associate the plot with the Fit Function panel and set fitting range to be between approximately 2270 and 5000 microseconds

  5. Right click on plot and select Add background... then FlatBackground

  6. Right click on plot and add peak IkedaCarpenterPV. This is peak function where some parameters of the peak function may be related to instrument geometry. As of this writing scientist(s) of the GEM instrument modified the file MantidInstall/instrument/GEM_Parameters.xml such that when you added the IkedaCarpenterPV peak it automatically selected some sensible starting parameter values. This is evident from the starting guess of the peak width but also by inspecting this function in the Fit Function panel

  7. Hold down shift key and click on top of the two other peaks

  8. Plot (fitting) guess and what you should see is something similar to

    ExerciseFittingMBCguess.png where the red line is the guess

  9. Remove plot guess

  10. Fit the data with the model, where the output should be something similar to

    ExerciseFittingMBCfit.png where the red line is here the fit

  11. clear the model

  12. Plot the spectrum in GEM63437_focussed_3

  13. Using the same background and peak fitting function as above fit the region between about 2000 and 9400 microseconds, and obtain a result similar to

    ExerciseFittingMBCfit_2.png Note this will take a while as it is a fit with almost 40 independent parameters to optimise.

  14. Optionally using a similar approach try to fit the spectrum in for example GEM63437_focussed_5

Exercise 3

  1. Load the MUSR00015189 data set.
  2. Plot a spectrum.
  3. Start the fitting interface.
  4. Follow the steps described earlier to add and set up a user defined function (UserFunction).
  5. Define a function with Formula = h*exp(-a*x)
  6. Fit the data.