Update NaN filtering in InterpolatingMap #1302
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the code in this PR do / what does it improve?
Fixes InterpolatingMap so we do not crash with scipy 1.11.
Can you briefly describe how it works?
Scipy 1.11's kdtree no longer accepts nonfinite values (scipy/scipy#18502). However, we sometimes use NaN to represent missing/undefined values, e.g. for drift time if an event has no S1.
Currently we pass all points to InterpolatingMap, then force the result to NaN for points that have nonfinite distance to the neighbours the kdtree finds. That's fine in our current scipy 1.10 environment, but once we update (XENONnT/ax_env#353) there will be problems.
This PR instead checks for NaN before passing the points to InterpolatingMap to avoid crashing.
Can you give a minimal working example (or illustrate with a figure)?
See the new unit test.
I tried processing a small run 026195 locally with scipy 1.11.3, and it crashed here
straxen/straxen/plugins/events/event_positions.py
Line 164 in 933cc54