Repository navigation
fix: Preserve Sibson coordinates across internal edges #610
Description
Overview
Audit #603 found incorrect internal-edge Sibson coordinates and near-edge cancellation that can return weights summing above one without a diagnostic flag. This follow-up is filed separately; the audit retains strict expected-failure witnesses.
Plan
- Reproduce independent square-symmetry, partition and both-sided continuity failures.
- Preserve natural-neighbor support on internal edges and distinguish hull-edge limits.
- Handle area cancellation before normalization and positive filtering.
- Validate eager/JIT behavior and promote audit regressions after repair.
Detailed implementation plan
Affected repositories: PyAutoArray (primary), autolens_workspace_test. Suggested branch: feature/sibson-internal-edge-continuity.
Inspect autoarray/inversion/mesh/interpolator/sibson.py:_sibson_single_from_tables, especially normalization/positive filtering and the unconditional on-edge barycentric fallback. Establish independent symmetric and asymmetric reference coordinates before choosing an algorithmic repair. Test internal versus hull edges, exact/nextafter/finite offsets, nonnegative partition and affine precision, diagnostic flags and eager/JIT parity. Run focused interpolation tests, full library tests and downstream source-recovery smoke. Queue behind audit #603; no implementation or new worktree begins during filing.
Current shared worktrees are on feature/mesh-interpolator-numerics-audit with audit-only tests/scripts uncommitted. User explicitly authorized separate filing of bugs found by the audit.
Original Prompt
Audit finding and authorized follow-up
Fix Sibson interpolation at internal edges
Type: bug
Target: PyAutoArray
Repos:
- PyAutoArray
- autolens_workspace_test
Difficulty: large
Autonomy: supervised
Priority: high
Status: formalised
Consequence: glance
Witness: Square-symmetry center weights are 1/4 each; near-edge weights remain nonnegative, sum to one, and agree continuously from both sides under eager/JIT execution.
Review-minutes: 15
Unattended: ready
Fix Sibson interpolation at internal edges
Type: bug
Target: autoarray
Repos:
- PyAutoArray
- autolens_workspace_test
Difficulty: large
Autonomy: supervised
Priority: high
Witness: Square-symmetry center weights are 1/4 each; near-edge weights remain nonnegative, sum to one, and agree continuously from both sides under eager/JIT execution.
Review-minutes: 15
Found during approved audit PyAutoArray#603. Original user instruction: "Any bug found is filed separately; this task is the audit, not the fixes."
In autoarray/inversion/mesh/interpolator/sibson.py:_sibson_single_from_tables, every on-edge query is replaced with seed-triangle barycentric weights, including internal edges where off-edge natural neighbors contribute. For square points [(-1,-1),(-1,1),(1,-1),(1,1)], query(0,0), independent symmetry requires four weights0.25 and interpolated y*x=0. Actual weights0.5 for opposite diagonal nodes yield1. Lattice mesh boundary sweep found jumps up to0.02680921 at +/-1e-8 around internal edge midpoints.
Near the square center at (+/-1e-8,0), cancellation yields returned positive weights summing1.123877166 and interpolated yx=-1.123877166, with no overflow/degenerate flag. Code normalizes signed contributions before discarding negative weights. At epsilon0.01 weights sum1 and yx is near0; error worsens at1e-6 and1e-8.
Plan a separate algorithmic repair preserving full natural-neighbor cavities at internal edges, using a hull-edge limiting rule only where appropriate, and robustly handling area cancellation before normalization/filtering. Validate independent symmetric and asymmetric reference fixtures, both-sided finite and nextafter edge probes, affine precision, partition/nonnegative support, eager/JIT parity and source recovery. Promote audit strict xfails after repair. No production fix is part of audit#603; shared worktrees remain claimed by the audit until shipping.
Activity