[Python][UHI] Fix handling of infinite upper bin edges in sliced histograms #20146
+40
−10
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.
This Pull request:
Changes or fixes:
When slicing histograms containing an axis with an infinite upper bin edge, the
SliceHistoInPlace
method produced invalid axis limits (NaN
) in the resulting slice. This was caused by calling theSetBins
overload using(lowEdge, upEdge)
limits, which fails for axes that extend to infinity. Since the resulting sliced histogram had wrong axis values, any following operation including projections had the wrong output.This PR updates
SliceHistoInPlace
to compute and store the full bin edge arrays for each dimension instead.The reproducer from issue #20077 now yields identical results for both
h.ProjectionY()
andh[uhi.sum, :]
.Checklist:
Note
This PR fixes #20077 partially by addressing the second part of the issue
This implementation makes sure the UHI projection result is the same the original ROOT projection methods, it doesn't however change the behavior of
ProjectionY()
described in the first part of the issue issue