-
Notifications
You must be signed in to change notification settings - Fork 272
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 HillasIntersection error for badly reconstructed events #2265
Conversation
ctapipe/reco/hillas_intersection.py
Outdated
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
Could you add a test for this case? I.e. by constructing an ArrayEvent
with specific values in the HillasParameterContainer
that triggers this issue?
ctapipe/reco/hillas_intersection.py
Outdated
FOV_ANGULAR_DISTANCE_LIMIT = 45 * u.deg | ||
|
||
|
||
def far_outside_fov(fov_lat, fov_lon): |
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.
I'd make this private (i.e. add an underscore in front)
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.
Yes, no problem
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.
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.