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

Exercise 3ΒΆ

The aim of this exercise is to write a small algorithm that wraps a small script that focuses some powder diffraction data.

Write an algorithm called PowderDiffractionReduce. The algorithm should have 3 properties:

  • Filename: A FileProperty for a TOF data file to load (ignore extensions)

  • CalFilename: A FileProperty for a cal file (ignore extensions)

  • OutputWorkspace: An output WorkspaceProperty to hold the final result.

The steps the algorithm should perform are:

  1. Use the Load algorithm to load the TOF data

  2. Apply the calibration file using ApplyDiffCal

  3. Run ConvertUnits on the TOF data to convert to dSpacing

  4. Run DiffractionFocussing on the previous output & focus the data using the same cal file from the earlier step (called a grouping file here)

  5. Set the output from the DiffractionFocussing algorithm as the output of PowderDiffractionReduce

  6. Delete the temporary reference using DeleteWorkspace

To test the algorithm, execute the script that contains the algorithm to register it with Mantid. It will then show up in the list of algorithms. Use the following inputs:

  • Filename: HRP39182.RAW

  • CalFilename: hrpd_new_072_01_corr.cal

  • OutputWorkspace: focussed

When plotting the output workspace it should look like this:

Plot with 3 spectra

Once finished check your answer with the provided Exercise 3 Solutions