Repository navigation
Named refusals for opposing infinite tails and non-finite z-score scales - #72
Merged
Merged
Conversation
…ssage math.fsum raised a bare ValueError or OverflowError. Non-finite tail sums are now detected first and refused, naming the tails concerned (fitting adds the group and channel). Valid inputs are unchanged. Fixes #71 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
The shared refusal told the user the intensity spread was zero even when the scale was inf or nan (for example float64 pixels near the type's limits). The two cases now have their own messages. Fixes #70 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
guijacquemet
marked this pull request as ready for review
November 6, 2026 12:40
This was referenced Nov 6, 2026
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 #71, fixes #70
What changed
_mean_with_tails(pooling.py) checks the tail sums are finite beforemath.fsum; otherwise it raises aValueErrornaming each non-finite tail and noting opposite-sign infinities.fitalready prefixes the group and channel. Regression test:test_opposing_infinite_tail_sums_are_a_named_refusal(fails on main with the bare-inf + inf in fsum)._parameters(normalization.py) now refuses a non-finite scale with an overflow message instead of "spread is zero"; zero/negative scale keeps its message. Regression test in test_normalization.py (fails on main).Gate
python tools/check.py: 634 passed, 2 skipped (tests/test_rgb.py:78,csbdeepnot installed), 0 failed; code rules and ruff clean.tools/dump_outputs.pydigest identical on main and this branch (dfd5e740e04e16057bc6a017e844ae62cb94025690531b443a9489f52900537e), so valid-input outputs are bitwise unchanged.Generated by Claude Code