Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix symmetry issue in solid angle calculation for WcsGeom #2035
I will explain the problem, and what is causing it:
In the image above I have created a Wcs Map centred on the origin with three bins in each axis. Currently the dx values for the solid angle calculation are calculated along the bottom of the pixels as shown in the above figure. Due to the great circle separations of the coordinate frame, the separation between the lon coordinates of the pixel edges reduces as you increase/decrease in lat. As the bottom of the pixels is symmetric for the top two pixels, they have the same x separation. They will therefore result in the same solid angle. Whereas the bottom pixel will have a different solid angle value, as x2 is measured at a further distance along lat from the origin.
The problem I see with this is the solid angle measured for each pixel is not symmetric about the origin. I would have expected the top and bottom pixel to have the same solid angle value, as they both have the same distance along the lat axis.
If one instead measures the separation along the centre of the pixel, as show above, then the calculation is symmetric about the origin, and the solid angles come out as expected.
The above image shows the expected area distribution across pixels.
registerrier left a comment •
Looks good. It is nice to have spotted that.
How significant is the change in the solid angle results for typical test cases we have implemented. I imagine there should be some change in many gammapy.cube tests, no?
I have committed the changes required for other tests that had a small (on the order of 0.01%) change in the fixed values