Ticket #9390 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Convert empty to tof

Reported by: Ricardo Leal Owned by: Ricardo Leal
Priority: major Milestone: Release 3.2
Component: Framework Keywords:
Cc: Blocked By: #9523
Blocking: Tester: Russell Taylor

Description (last modified by Ricardo Leal) (diff)

At the ILL the data must be loaded in raw format (no units used). The X-axis represent the time channel number. The unit "Empty" will be used.

This algorithm converts thus the channel number to time of flight using:

  • Spectrum or list of spectra indices to look for the elastic peak. They must be at the same distance from the sample.
  • Elastic peak boundaries - The boundaries, or indices, where the algorithm should look for the elastic peak inside the selected spectra.

I looked into adding this as a new Unit and using convert units for converting channel to TOF, but additional arguments needed to find the elastic peak make this not suitable for the convertUnits algorithm...

Change History

comment:1 Changed 6 years ago by Owen Arnold

  • Status changed from new to assigned

comment:2 Changed 6 years ago by Ricardo Ferraz Leal

  • Status changed from assigned to inprogress

Re #9390 Initial files for the algorithm.

Changeset: bfbedd21df95d42c077bc2189b832dd31fd58955

comment:3 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Initial fitting. Needs testing.

Changeset: 6f3b9e2069bfe5c89b4d308adad254804d2f2378

comment:4 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Spectra peak fit and EPP finding works.

Changeset: 1c62387c1353e6fc1bf36464831035b716f266e9

comment:5 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 X Axis calculation OK.

Changeset: 8b3dc7be207440831971bab4f95f6959909888fb

comment:6 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Algo works finding 1 spectrum epp. Todo: >1

Changeset: 3639001dd1d17e5ed5b401f03fb3846874221b7c

comment:7 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Added test with 2 spectra at the same distance

Changeset: d301cb29ffec7ca0cc96ac9c8b369a75abd36a26

comment:8 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Fix OpenMP index signed integral type and doxygen warning.

Changeset: fd64d61669cd0e121f6499a94016453b9034572d

comment:9 Changed 6 years ago by Ricardo Leal

Testing

So far there's no way to test this with real data... I would suggest to have a look at the test and at the procedure below (see also the comments!).

# Load some data from IN16B. This is just simulated data. These instrument is not running yet.
Load(Filename=r'/home/leal/git/mantid/Test/AutoTestData/ILLIN16B_034745.nxs',OutputWorkspace='ILLIN16B_034745')

# Since this algorithm won't be used by IN16B the property "channel_width" doesn't exist.
# Let's add it
ws = mtd['ILLIN16B_034745']
r = ws.getRun()
r.addProperty("channel_width", 10, True)

# Find the elastic peak in spectra index 309 using channell between '700-900'. 
# Ploting this spectra 
ConvertEmptyToTof(InputWorkspace='ILLIN16B_034745',OutputWorkspace='test',ListOfSpectraIndices='309',ListOfChannelIndices='700-900')

# The results are not correct (because we don't have right distances in the IDF) but the important here is to see that ConvertUnits work.
ConvertUnits(InputWorkspace='test',OutputWorkspace='DE',Target='DeltaE',EMode='Direct',EFixed='2.08')

comment:10 Changed 6 years ago by Ricardo Leal

  • Description modified (diff)

comment:11 Changed 6 years ago by Yannick Raoul

Re #9390 Convert small arrays to float properties

Changeset: 5fe9c230b47485f9445d25047371453856241c7a

comment:12 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Validate spectra and channel inputs.

Changeset: 087df676f1bc958b512f1b028da65edffc05258b

comment:13 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Correct vector boundaries in the test.

Changeset: a61def696c8b40e7b8d14dff0fd9964d3e5f5343

comment:14 Changed 6 years ago by Ricardo Leal

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

See testing above.

comment:15 Changed 6 years ago by Russell Taylor

  • Status changed from verify to verifying
  • Tester set to Russell Taylor

comment:16 Changed 6 years ago by Russell Taylor

The macro says that the branch is not fully merged to develop, so it needs another 'checkbuild'. Also, there are some formatting issues that don't match the Mantid coding standards - use of tab indentation instead of (2) spaces, alignment of long function signatures, curly brackets on the end of a line instead of a line of their own. There are also a few lines of commented-out code that should be deleted.

comment:17 Changed 6 years ago by Russell Taylor

  • Status changed from verifying to reopened
  • Resolution fixed deleted

The comments above need to be addressed.

comment:18 Changed 6 years ago by Ricardo Leal

I have been away. Thanks for the comments. I will address them asap.

comment:19 Changed 6 years ago by Ricardo Ferraz Leal

  • Status changed from reopened to inprogress

Re #9390 Corrected formatting issues.

Changeset: a042b7610eeefd6db628c45969a5cf7fcf71d98b

comment:20 Changed 6 years ago by Ricardo Leal

I'm using Stroustrup code style (based on Kernighan and Ritchie's).

I have addressed the majority of the issues.

Sorry, don't like the curly brackets starting on an empty line. It's optional according to the Mantid coding standards. If you really think it's needed I'll do it.

comment:21 Changed 6 years ago by Russell Taylor

So it does. Well, I'll resist the temptation to edit the wiki so it's mandatory :) It's the tabs I really don't like because of how they render differently in different places.

comment:22 Changed 6 years ago by Jay Rainey

  • Blocked By 9523 added

comment:23 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Added ElasticPeakPosition ElasticPeakPositionSpectrum fields.

Changeset: 0ad3eb9b2a51dabe53ef16b0d8f13c0e853e131e

comment:24 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Fix old doc format.

Changeset: 30d5d87268671534786d9fb9deba22c80a3d8395

comment:25 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 Fix double from int convertion warning.

Changeset: eb1b6413268bf1954a0f8bfd7b5ca45dfaa5d064

comment:26 Changed 6 years ago by Ricardo Ferraz Leal

Re #9390 New doc format.

Changeset: 053ee74cca71cdf1f8be06814b97419971692520

comment:27 Changed 6 years ago by Ricardo Leal

Testing

So far there's no way to test this with real data... I would suggest to have a look at the test and at the procedure below (see also the comments!).

# Load some data from IN16B. This is just simulated data. These instrument is not running yet.
Load(Filename=r'/home/leal/git/mantid/Test/AutoTestData/ILLIN16B_034745.nxs',OutputWorkspace='ILLIN16B_034745')

# Since this algorithm won't be used by IN16B the property "channel_width" doesn't exist.
# Let's add it
ws = mtd['ILLIN16B_034745']
r = ws.getRun()
r.addProperty("channel_width", 10, True)

# Find the elastic peak in spectra index 309 using channell between '700-900'. 
# Ploting this spectra 
ConvertEmptyToTof(InputWorkspace='ILLIN16B_034745',OutputWorkspace='test',ListOfSpectraIndices='309',ListOfChannelIndices='700-900')

### Or, use some fixed position (no peak search and fitting required):
# ConvertEmptyToTof(InputWorkspace='ILLIN16B_034745',OutputWorkspace='test',ElasticPeakPosition='800', ElasticPeakPositionSpectrum='309')


# The results are not correct (because we don't have right distances in the IDF) but the important here is to see that ConvertUnits work.
ConvertUnits(InputWorkspace='test',OutputWorkspace='DE',Target='DeltaE',EMode='Direct',EFixed='2.08')

comment:28 Changed 6 years ago by Ricardo Leal

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

comment:29 Changed 6 years ago by Russell Taylor

  • Status changed from verify to verifying

comment:30 Changed 6 years ago by Ricardo Ferraz Leal

  • Status changed from verifying to closed

Merge branch 'feature/9390_convert_empty_to_tof' of github.com:mantidproject/mantid into feature/9390_convert_empty_to_tof

Full changeset: b8525487ee30584a7f619e8ac9b0daab3e177466

comment:31 Changed 6 years ago by Yannick Raoul

Merge branch 'feature/9390_convert_empty_to_tof' of github.com:mantidproject/mantid into feature/9390_convert_empty_to_tof

Full changeset: a39400845cf48b6e6df6015a07824a78e71592b2

comment:32 Changed 6 years ago by Ricardo Ferraz Leal

Merge branch 'feature/9390_convert_empty_to_tof' of github.com:mantidproject/mantid into feature/9390_convert_empty_to_tof

Full changeset: 1eaa8e03c848e6c17aa2671ddfeacd44f5061337

comment:33 Changed 6 years ago by Russell Taylor

Merge remote branch 'origin/feature/9390_convert_empty_to_tof'

Full changeset: cb358f09d80a580faa62876a014166cd778870dc

comment:34 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10233

Note: See TracTickets for help on using tickets.