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, before taking the difference between the minimum and maximum angles.
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, before taking the difference between the minimum and maximum angles.
Can you give a minimal working example (or illustrate with a figure)?
An example edge case is some generic array around the $-\pi$ and $+\pi$ boundary where the min and max $\theta$ are -3.14 and 3.14 respectively.
We expect the uncertainty to be
np.pi - 3.14 = 0.0015926535897929917
.I have also loaded this with an existing run using a few data points that fall along the -pi and +pi seam.
Notes on testing
All italic comments can be removed from this template.