mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
207 stars 122 forks source link

Improve shoebox position determination in `IntegratePeaksShoeboxTOF` #37621

Open RichardWaiteSTFC opened 3 days ago

RichardWaiteSTFC commented 3 days ago

Description of work

Improve shoebox position determination in IntegratePeaksShoeboxTOF by doing the following:

  1. Stop smoothing the I/sigma from the shoebox convolution - this was over smoothing as the shoebox is effectively also doing some smoothing.
  2. Use label to find contiguous regions of statistically significant I/sigma and find regions closer to predicted peak position than any other position
  3. Get a better initial shoebox dimensions by allowing float NFHWM

image

Purpose of work

In reducing SXD data for Nick Funnell it was found that the shoebox would often find a region of I/sigma far away from weak peak positions - this was because it previously centred the shoebox on the maximum I/sigma, but if there was a nearby peak which wasn't in the peak table the shoebox could go to the wrong peak position. This should be fixed by (2)

There is no associated issue.

To test:

(1) Run this script change OuptutFile

ws = Load(Filename=r'SXD23767.raw', OutputWorkspace='SXD23767')
peaks = FindSXPeaksConvolve(InputWorkspace=ws, PeakFindingStrategy="IOverSigma", NCols=7, NRows=7, NFWHM=6, ThresholdIoverSigma=5)

kwargs = {"InputWorkspace": ws, "PeaksWorkspace": peaks, "OutputWorkspace": 'peaks_int', 
          "NRows": 7, "NCols": 7, "GetNBinsFromBackToBackParams": True, "NFWHM": 3, "NShoeboxInWindow": 3,
          "WeakPeakThreshold": 0, "IntegrateIfOnEdge": True, "LorentzCorrection": False,
          "OutputFile": '//olympic/Babylon5/Public/RWaite/test_shoebox.pdf'}
IntegratePeaksShoeboxTOF(**kwargs)

(2) Check the pdf - the box should be centered on the peak in the data nearest the red x

This does not require release notes because fill in an explanation of why If you add release notes please save them as a separate file using the Issue or PR number as the file name. Check the file is located in the correct directory for your note(s). -->


Reviewer

Please comment on the points listed below (full description). Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

Functional Tests

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.