Skip to content

JP-4372: Fix edge cases in bounding box computations#254

Open
mcara wants to merge 6 commits into
spacetelescope:mainfrom
mcara:enhance-handling-of-degenerate-poly
Open

JP-4372: Fix edge cases in bounding box computations#254
mcara wants to merge 6 commits into
spacetelescope:mainfrom
mcara:enhance-handling-of-degenerate-poly

Conversation

@mcara

@mcara mcara commented Jun 10, 2026

Copy link
Copy Markdown
Member

Fixes a crash in the JWST pipeline which happens when one of the images has three sources detected and they lie on almost a straight line. The convex hull of these points is a triangle with minimal height resulting in the spherical polygon being considered degenerate since all vertices lie on a great circle.

This PR replaces convex hull with a bounding rectangle of height or with of no less than 1 pixel only when the spherical polygon created with the convex hull is degenerate.

Closes JP-4372

Regression tests:

@mcara mcara self-assigned this Jun 10, 2026
@mcara mcara requested a review from a team as a code owner June 10, 2026 05:48
@mcara mcara added the enhancement New feature or request label Jun 10, 2026
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.66667% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.97%. Comparing base (e6728a1) to head (b3e497d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tweakwcs/wcsimage.py 46.66% 32 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
- Coverage   92.35%   90.97%   -1.39%     
==========================================
  Files          11       11              
  Lines        2015     2072      +57     
==========================================
+ Hits         1861     1885      +24     
- Misses        154      187      +33     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mcara mcara force-pushed the enhance-handling-of-degenerate-poly branch from 944fc8b to d5f2ab1 Compare June 10, 2026 05:51
@mcara mcara requested a review from tapastro June 10, 2026 06:33
@mcara mcara added this to the Better Awsomeness milestone Jun 10, 2026
@tapastro

Copy link
Copy Markdown

I can't say that I fully follow the new code - it seems like there are instances were 0.5 is added or removed from array values to generate some non-zero areas, but I don't understand what units x and y typically have here - pixel coordinates, or something else? It's not immediately clear to me that 0.5 is a small value. But I think the concept appears sound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants