Skip to content

Named refusals for opposing infinite tails and non-finite z-score scales - #72

Merged
guijacquemet merged 3 commits into
mainfrom
claude/named-refusals-70-71
Nov 6, 2026
Merged

guijacquemet merged 3 commits into
mainfrom
claude/named-refusals-70-71

Conversation

@guijacquemet

Copy link
Copy Markdown
Contributor

Fixes #71, fixes #70

What changed

  • Pooled mean: opposing infinite tails raise a bare math.fsum error instead of a named refusal #71: _mean_with_tails (pooling.py) checks the tail sums are finite before math.fsum; otherwise it raises a ValueError naming each non-finite tail and noting opposite-sign infinities. fit already 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).
  • Non-finite z-score scale is refused as 'spread is zero' #70: _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).
  • Third commit: docstrings and a used expression required by the repository's code rules.

Gate

python tools/check.py: 634 passed, 2 skipped (tests/test_rgb.py:78, csbdeep not installed), 0 failed; code rules and ruff clean.
tools/dump_outputs.py digest identical on main and this branch (dfd5e740e04e16057bc6a017e844ae62cb94025690531b443a9489f52900537e), so valid-input outputs are bitwise unchanged.


Generated by Claude Code

…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
@guijacquemet
guijacquemet marked this pull request as ready for review November 6, 2026 12:40
@guijacquemet
guijacquemet merged commit 5848efc into main Nov 6, 2026
8 checks passed
@guijacquemet
guijacquemet deleted the claude/named-refusals-70-71 branch November 6, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pooled mean: opposing infinite tails raise a bare math.fsum error instead of a named refusal Non-finite z-score scale is refused as 'spread is zero'

2 participants