Skip to content

Feature/voronoi safe fallback#211

Merged
Jammy2211 merged 7 commits intomainfrom
feature/voronoi_safe_fallback
Feb 11, 2026
Merged

Feature/voronoi safe fallback#211
Jammy2211 merged 7 commits intomainfrom
feature/voronoi_safe_fallback

Conversation

@Jammy2211
Copy link
Owner

This pull request improves the robustness of the Voronoi area calculation in the scipy_delaunay function by adding error handling. Now, if the Voronoi computation fails (for example, due to Qhull precision errors), the code will gracefully fall back to using barycentric dual areas instead of crashing.

This is because the new border relocation scheme could sometimes create source pixel distributions which broke the Voronoi code, albeit this happened rarely for odd mass models.

Error handling and fallback logic:

  • Added a try/except block around the call to voronoi_areas_numpy(points) in scipy_delaunay, so that if an exception occurs (such as a Qhull precision problem), the code prints an informative message and falls back to calculating areas using barycentric_dual_area_from(points, simplices, xp=np) instead.

@Jammy2211 Jammy2211 merged commit 994e695 into main Feb 11, 2026
8 checks passed
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.

1 participant