Skip to content

Make virtual-guide trace comparisons robust to round-off in silent components - #956

Merged
agianno merged 1 commit into
masterfrom
fix/sibc-2d-test-tolerance
Nov 9, 2026
Merged

agianno merged 1 commit into
masterfrom
fix/sibc-2d-test-tolerance

Conversation

@agianno

@agianno agianno commented Nov 9, 2026

Copy link
Copy Markdown
Member

Summary

tests/impedance_surfaces/test_2d_sibc.py::test_rotated_virtual_fields[True-double-+-1-2-TE] failed on hosted CI for #953 (7 Nov) and #955 (9 Nov), neither of which touches the solver, while master passed the same suite at the same commit on 5 Nov.

The reported "relative error" was 2e-3, but the underlying difference between the reference and virtual-guide runs was ~5e-13 on a field of amplitude 216. The comparison scaled each receiver component by its own peak with a floor of 1e-12 of the global peak, so the three identically zero out-of-plane components of a reduced 2D run were effectively compared against an absolute tolerance of ~4e-18, below double round-off. Any residual there, however small, failed the test.

The round-off divergence itself only shows up on the hosted runners: with MKL numpy, with the same OpenBLAS numpy as the CI wheel, at 1 to 8 OpenMP threads, 1 to 4 BLAS threads, across the whole file in one pytest process, and twelve back-to-back repetitions under a 36-process CPU load, the two runs are bit-identical here, including every port and mode-solver array.

Changes

  • Add normalized_trace_error() to testing/validation/impedance_surface/validate_2d.py. Components carrying signal are still scaled by their own peak, so the weak magnetic traces are held to the same relative accuracy as the strong electric ones. Components whose reference peak is below 1e-6 of the global peak are measured against the global peak instead.
  • Use it in test_virtual_continuation, test_rotated_virtual_fields and test_extruded_impedance_virtual_guide_matches_monolithic, which shared the old floor.
  • Hold the inactive grid components of the reduced run to the same round-off bound (tolerance * peak) instead of exact zero.

No solver code is changed. The report script compare_guides() keeps its own metric.

Verification

Synthetic check of the helper: a CI-sized residual (5e-13 in a silent component plus 1e-13 noise on Ex) scores 2.3e-15; a 1e-7 relative error on Hy scores 1e-7; a 1e-5 absolute leak into a silent component scores 4.6e-8; all against the 2e-8 threshold.

Both changed test files pass locally with the OpenBLAS build matching CI: 201 passed, 120 deselected by the standard markers.

🤖 Generated with Claude Code

…mponents

test_rotated_virtual_fields[True-double-+-1-2-TE] failed twice on hosted CI
(PRs #953 and #955, neither of which touches the solver) with a "relative
error" of 2e-3 while the actual difference between the reference and virtual
runs was ~5e-13 on a field of amplitude 216. The comparison scaled each trace
component by its own peak with a floor of 1e-12 of the global peak, so the
three identically-zero out-of-plane components of a reduced 2D run were
compared against an absolute tolerance of ~4e-18, far below double round-off.
Any residual there, however small, failed the test. The divergence itself only
appears on the hosted runners and could not be reproduced locally with MKL or
OpenBLAS numpy, any thread count, repeated in-process runs or CPU contention.

Add normalized_trace_error() to the 2D validation module: components that
carry signal are still scaled by their own peak, while components whose
reference peak is below 1e-6 of the global peak are measured against the global
peak. Use it in the three tests that shared the old floor, and hold the
inactive grid components of the reduced run to the same round-off bound
instead of exact zero.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@agianno
agianno merged commit 72dfe75 into master Nov 9, 2026
9 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