-
Notifications
You must be signed in to change notification settings - Fork 122
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 signal to sigma post fitting check #37826
Conversation
a69ea49
to
6173d98
Compare
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 this, the calculation of I/sigma looks good.
Just some suggested changes and would it be possible to add a test and release notes for this .
Sorry I haven't been able to test this yet due to boost update requiring a new build, but I will do manual testing once comments addressed. Thanks!
6173d98
to
2f196ea
Compare
46efb92
to
8fc3890
Compare
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.
Code looks good - but I think there may be something wrong with the I/sigma calculation.
It looks to me like the I/sigma of the peak in your test code should ~12
intens = np.sum(ws.readY(0) - ws.readY(0)[0])
sigma = np.sqrt(np.sum(ws.readE(0)**2))
print(intens/sigma) # 12.24
It looks to me though that FitPeaks
only rejects the peak around ~100
Can you see what's going on?
@MohamedAlmaki This looks like genuine test failures. |
Yes, I am working on fixing it |
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 this - looks good. Now in test script the chi-squared of the peak gets set to DBL_MAX around I/sigma ~ 12
Description of work
This pull request introduces a new property to FitPeaks and PDCalibration: the option to set a minimum signal-to-sigma ratio for post-fitting. When this property is provided, peaks with a signal-to-sigma ratio below the specified minimum will be rejected. The signal-to-sigma ratio is calculated as the integrated fitted peak minus the integrated background, divided by the sigma, which is calculated using the quadrature sum of the errors.
Fixes #35224.
To test:
1- Run the following script:
2- Check the fitted data and params, you will notice the peak has been rejected.
3- Rerun the same script but with MinimumSignalToSigmaRatio='150', then you will see the expected fitted peak.
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.