-
Notifications
You must be signed in to change notification settings - Fork 33
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
Fix theta uncertainty bug #1466
Conversation
for more information, see https://pre-commit.ci
…to theta_uncertainty_fix
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 @napoliion .
In general, I think we should consider a corner case where theta_array_shift
still crosses the
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.
In addition to the specific comments, the shared code should be refractored into a static method as @dachengx suggested, and the inconsistency in naming should be fixed.
@juehang is referring to |
Before you submit this PR: make sure to put all operations-related information in a wiki-note, a PR should be about code and is publicly accessible
What does the code in this PR do / what does it improve?
This fixes a bug found by @sebvetter (figure below) in how theta uncertainties were handled due to contours that passed over the -pi and pi boundary. These contours would have an uncertainty that is an order of magnitude smaller than the contours that do not cross this boundary.
Can you briefly describe how it works?
The theta uncertainty is calculated as the difference between the min and max$\theta$ of a contour. The correction is to rotate the contour around (0,0) by the average $\theta$ within the contour so that the contour is now around $\theta = 0$ to avoid the seam, then add $\pi$ and modulo $2\pi$ to handle large angular contours.
Can you give a minimal working example (or illustrate with a figure)?
Given a generated fake contour, we can show that this method works for the three cases:
Below is a quick minimal modified example of the code above on a fake generated contour located at the seam we want to test this method on:
which prints:
After generating the above contour, the contour can be moved to show that this still returns the expected values at angles on and off of the$-\pi$ and $\pi$ seam.
which also prints:
Because the contour is not a perfect circle in the above example (only 17 points are selected, as per the CNF contour array shape), rotating the contour will cause slight differences in
theta_diff
depending on the orientation of this contour.To check that this works on data, I have loaded a set of events from a Kr83m run to test. The above figure was reproduced and after rerunning with the code change, the bug is no longer visible.
For event contours:
For peak contours:
(The sharp dip in the center is a result of very small radii close to 0.)