Repository navigation
Interpolate percentiles between finite extremes without overflowing the gap - #74
Merged
Merged
Conversation
…he gap Fixes #32 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #32
_linear_percentileformedabove - below, which overflows to inf for finite endpoints further apart than float64 (e.g. -1e308 and 1e308), giving inf/NaN where the interpolation is representable. The arithmetic now moves into_lerp: only when the gap overflows and both endpoints are finite does it interpolate from the halved endpoints; every other input keeps NumPy's arithmetic unchanged. Non-finite endpoints behave as before (#70/#72 cover the tails).Note: building a histogram from such pixels still overflows bin centres in
histogram.py; that is outside this issue, so the regression test calls_linear_percentiledirectly with q = 0/25/50/75/100 against an exactfractionsreference. It fails on main (12 failures) and passes here.Bitwise:
tools/dump_outputs.pySHA-256 identical on main (5848efc) and this branch:dfd5e740e04e16057bc6a017e844ae62cb94025690531b443a9489f52900537e.Gate:
python tools/check.py649 passed, 2 skipped (csbdeep not installed, tests/test_rgb.py:78), code rules clean; baseline shrank by one entry (_linear_percentilelength).Generated by Claude Code