Fix HillasIntersection error for badly reconstructed events#2265
Conversation
| # Catch events reconstructed at great angular distance from camera center | ||
| # and retrun INVALID container to prevent SkyCoord error below. | ||
| if ( | ||
| np.abs(src_fov_lat) * u.rad > 45 * u.deg |
There was a problem hiding this comment.
I'd define the 45 ° limit in a named constant on top, something like FOV_ANGULAR_DISTANCE_LIMIT = 45 * u.deg and then compare to FOV_ANGULAR_DISTANCE_LIMIT.to_value(u.rad) instead of multiplying both sides with the unit (faster).
Maybe you can also put this part into a function so it looks like this:
if far_outside_fov(src_fov_lat, src_fov_lon):
return INVALID
maxnoe
left a comment
There was a problem hiding this comment.
Could you add a test for this case? I.e. by constructing an ArrayEvent with specific values in the HillasParameterContainer that triggers this issue?
| FOV_ANGULAR_DISTANCE_LIMIT = 45 * u.deg | ||
|
|
||
|
|
||
| def far_outside_fov(fov_lat, fov_lon): |
There was a problem hiding this comment.
I'd make this private (i.e. add an underscore in front)
maxnoe
left a comment
There was a problem hiding this comment.
Looks good, aside from two minor comments regarding performance and visibility
|
Thanks! I will implement them and get back to you. |
|
@gschwefer Could you add a change-log entry? Just create a file |
|
@gschwefer Can you merge or rebase with the current |
|
Yes I will |
f751de2 to
2557709
Compare
Fix for issue #2264. Events with large reconstructed angular distances from the camera center now return the INVALID container.