Fix Cartesian text clipping by iterative range-space extent convergence in _finalize()#224
Merged
tshead2 merged 3 commits intosandialabs:mainfrom Mar 13, 2026
Merged
Conversation
Contributor
Author
|
Note: all tests passed when run locally. |
Contributor
Author
Member
|
This looks like a winner, thanks for your contribution! |
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.
Problem
Cartesian._finalize()had two related issues:numpy.max()on empty extent arrays, raising:ValueError: zero-size array to reduction operation maximum which has no identity.What this PR changes
_finalize_once()(original single-pass finalize logic),_finalize()wrapper that iteratively refines extent fitting.max_iter = 6px_tol = 0.05_ymin_rangeis top,_ymax_rangeis bottom.numpy.max()).max_iterand allows remaining overflow.Why this is safe
Convergence constants (private)
_CARTESIAN_FINALIZE_MAX_ITER = 6_CARTESIAN_FINALIZE_PX_TOL = 0.05Tests
Adds regression coverage in
features/cartesian-coordinates.featureand corresponding steps:Unreachable text extent uses bounded fallback iterations<= max_iter),This codifies expected fallback behavior for geometrically impossible fit cases.
Validation
Commits
d5023b79Add regression scenario for unreachable cartesian text extents7dfb935fFix cartesian finalize text extent convergence and overflow boundsExample