Ticket #8598 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Add algorithm to normalise compton scattering spectrum by hydrogen peak area

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: critical Milestone: Release 3.1
Component: Direct Inelastic Keywords:
Cc: Blocked By:
Blocking: Tester: Samuel Jackson

Description (last modified by Martyn Gigg) (diff)

This will require two new algorithms:

  1. ConvertToYSpace -

The required conversion is defined by equation (7) in this paper: http://link.aip.org/link/doi/10.1063/1.3561493?ver=pdfcov. As the mass & detector delay time are required to calculate Y we cannot simply add a new unit for ConvertUnits. The algorithm will have a single input, the mass and all other parameters: l1,l2,theta,efixed,t0 will be required to be attached to the workspace instrument.

  1. NormaliseByPeakArea -

This will use the above algorithm to convert the input TOF spectrum to yspace & then Fit the peak defined by the input mass value. The input data will then be normalised by the fitted peak area value.

Attachments

HydrogenPeakFit.jpg (1.4 MB) - added by Martyn Gigg 7 years ago.

Change History

comment:1 Changed 7 years ago by Martyn Gigg

  • Status changed from new to inprogress

comment:2 Changed 7 years ago by Martyn Gigg

  • Description modified (diff)
  • Summary changed from Add algorithm to convert X from TOF to compton scattering Y-space to Add algorithm to normalise compton scattering spectrum by hydrogen peak area

comment:3 Changed 7 years ago by Martyn Gigg

Basic structure for ConvertToYSpace algorithm

Refs #8598

Changeset: f7b330be5b3b8d144a1e2f9d3e5df2576f179104

comment:4 Changed 7 years ago by Martyn Gigg

Refactoring to avoid code duplication.

  • getComponentParameter is now only defined in ConvertToYSpace
  • DetectorParams struct has moved to ConvertToYSpace
  • Y calculation has moved to ConvertToYSpace

Refs #8598

Changeset: 06606cc87c57f610512cb29b61537f57ef9ebdd8

comment:5 Changed 7 years ago by Martyn Gigg

Tidy up in ConvertToYSpace and implement exec test

Refs #8598

Changeset: 4287d1f3f285c6796f16c4c357c205a1641d940f

comment:6 Changed 7 years ago by Martyn Gigg

Set units on output workspace.

Refs #8598

Changeset: cc054f995a23a612b2c3f9dee2cd88c45846fee8

comment:7 Changed 7 years ago by Martyn Gigg

Implement a profile function to fit a mass peak in Y-space.

Used in neutron compton scattering to Fit a spectrum using only the proton peak. Refs #8598

Changeset: 6c9b13e71e5c8b07939990cdf4faec8c1a0ed67f

comment:8 Changed 7 years ago by Martyn Gigg

Start of NormaliseByPeakArea algorithm

Refs #8598

Changeset: d3a554670c218be64ba0f002bcac2db40e9312e6

comment:9 Changed 7 years ago by Martyn Gigg

Refactor test helper to allow multiple spectra.

Refs #8598

Changeset: 0e5969b9890b5db3aa7721bd9d368bdafb8e1381

comment:10 Changed 7 years ago by Martyn Gigg

Symmetrised output is correct for non-sum behaviour

Refs #8598

Changeset: 343b03de957e2a3b5ee999ede90bced6b733d1e2

comment:11 Changed 7 years ago by Martyn Gigg

Implement summing behaviour in NormaliseByPeakArea.

Refs #8598

Changeset: 9eb98715068602cbe5a3cdb020a6c8d4288d47f3

comment:12 Changed 7 years ago by Martyn Gigg

Fix default value of test helper create2DWorkspaceWithFullInstrument

Accidentally changed the behaviour that everyone else was expecting. Refs #8598

Changeset: 28d9a8859d736d23dc8da108243cb98d93930946

comment:13 Changed 7 years ago by Martyn Gigg

Fix silly unit test mistake.

Refs #8598

Changeset: 8a0bfebef6515ca81f682e855a29cc718467db19

comment:14 Changed 7 years ago by Martyn Gigg

Fix system VesuvioFitting tests.

Converting the TOF from seconds to microseconds and then back seems to have caused instability in the fitting when including the background. It is actually more sensible to have convertToYSpace take the time in seconds anyway. Refs #8598

Changeset: ba48d4c771b60c7ce6d7289d5b7a39c6c0c5ee78

comment:15 Changed 7 years ago by Martyn Gigg

Branch: feature/8598_convert_to_yspace

Tester: First check that the system tests are passing.

The required data for the tests is on the ISIS archive in EVS cycle 09_1 & the IP file is attached to #8378.

from mantid.simpleapi import *

LoadVesuvio(Filename='14188-14195',OutputWorkspace='test_nosum',
            SpectrumList='135-142',Mode='SingleDifference',
            InstrumentParFile=r'IP0004_10.par')
CropWorkspace(InputWorkspace='test_nosum',OutputWorkspace='test_nosum',
              XMin='50',XMax='562')
NormaliseByPeakArea(InputWorkspace='test_nosum',Mass='1.0079',Sum=False,
                    OutputWorkspace='norm', YSpaceDataWorkspace='yspace',
                    FittedWorkspace='fitted',SymmetrisedWorkspace='sym')

Run the following script. It should produce 4 workspaces:

  • yspace, fitted and sym should all be in units of A-1
  • norm should be in units of tof

Plot spectrum 135 from yspace, fitted & sym on 1 plot. It should look like the attached image from the VMS manual with the exception that there is an additional peak between approx [-27,-24]A-1 that we chose not to exclude here.

Now plot spectrum 135 on both test_no_sum & norm. You should find that the norm workspace has the same features as test_nosum and test_nosum ~ 60.177*norm (to within expected precision)

Changed 7 years ago by Martyn Gigg

comment:16 Changed 7 years ago by Martyn Gigg

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:17 Changed 7 years ago by Martyn Gigg

Fix cppcheck scope error.

Refs #8598

Changeset: 16710a8cdceb9b5bc30b274110564500f690f937

comment:18 Changed 7 years ago by Martyn Gigg

Fix doxygen warning.

Refs #8598

Changeset: 3a534b82c2899d15f8ab8c7156901185683b9a35

comment:19 Changed 7 years ago by Martyn Gigg

Put back accidentally removed variable.

Refs #8598

Changeset: d43bfcb8fcb4036afd77b59c7787c795ea26d93d

comment:20 Changed 7 years ago by Samuel Jackson

  • Status changed from verify to verifying
  • Tester set to Samuel Jackson

comment:21 Changed 7 years ago by Samuel Jackson

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/8598_convert_to_yspace'

Full changeset: 5cfc6fbd16d17cc500df15b2039be3607b4010e8

comment:22 Changed 7 years ago by Samuel Jackson

Checked that everything mentioned in the testing description appears to work as expected. Plots match as in description. Checked that input workspace is approx. 60.177*norm. System tests are passing and code review looks good.

comment:23 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9442

Note: See TracTickets for help on using tickets.