New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to find peaks using ratio variance/ mean in FindSXPeaksConvolve #37171
Add option to find peaks using ratio variance/ mean in FindSXPeaksConvolve #37171
Conversation
For a constant background the Poisson distributed counts should have Variance = mean (i.e. ratio = 1) - in the region of a Bragg peak the variance/mean > 1. This idea is taken from DIALS software package for x-ray diffraction as described Winter (2018) https://doi.org/10.1107/S2059798317017235 - generalised to 3D TOF Laue
doc="Threshold value for variance/mean used to identify peaks.", | ||
) | ||
use_variance_over_mean = EnabledWhenProperty("PeakFindingStrategy", PropertyCriterion.IsNotDefault) | ||
self.setPropertySettings("ThresholdVarianceOverMean", use_variance_over_mean) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but the convention is to put new arguments at the bottom so as to preserve the positional argument order in the python wrapper. Sometimes if there are loads of parameters that makes it more likely no one will be using positional arguments, but there are not so many arguments here so it's probably better to keep it as is. Is that OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah understood, I guess users won't bother much since there is only a small number of params to fill.
@@ -37,7 +37,7 @@ Here is an example using the ``SXD`` class that finds peaks and then removes dup | |||
|
|||
# find peaks using SXD static method - determines peak threshold from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this comment needs to be updated to represent Variance over mean
Test passes on windows not on jenkins linux, asserts test the functionality sufficiently
Thanks for fixing the unit test issue and tested to be working properly as expected. Will approve after if you could update the above comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the PR! The changes are working perfectly and happy to approve!
Description of work
Add option to find peaks using ratio variance/ mean in FindSXPeaksConvolve - this is a peak finding criterion used in DIALS, Winter (2018)
https://doi.org/10.1107/S2059798317017235
Here it is performed by doing 2 convolutions to evaluate
E[y]
andE[y^2]
after scaling to ensure the data are in raw counts.This work was started because it was noticed while benchmarking peak finding algorithms as part of testing #37123 that
FindSXPeaksConvolve
using ratio of I/sigma, was picking up lots of spurious noisy peaks in bank 1 of SXD (higher gain as upgraded detector bank recently) unless quite a high value of I/sigma chosen.Here is a comparison of the two methods for an SXD run with lower stats
It can be seen that the new method (variance/mean) find ~15-20% more peaks that can be indexed with 90% accuracy with a hkl tolerance of 0.1 (note detector positions were calibrated prior to this benchmark). it also out performs the older
FindSXPeaks
algorithm withAllPEaks
strategy (see comments in #37123).There is no associated issue.
To test:
To-Do
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.