fix(rf): validate auto path integrals against all conductors and the mode plane bounds #3122
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.
Adding more aggressive validation, so users do not get confusing errors later.
Greptile Summary
This PR enhances validation in
AutoImpedanceSpecpath generation by adding two critical checks that prevent confusing errors from occurring later in the simulation pipeline:Validation against ALL conductors: Changed the conductor intersection check from using
filtered_conductor_shapely(which excludes conductors touching PEC boundaries) toisolated_conductor_shapely(all conductors). This prevents auto-generated path specifications from intersecting with ground planes or other conductors that were filtered out for being shorted to boundaries.Mode plane bounds validation: Added a new check to ensure bounding boxes don't extend outside the original mode plane bounds, which can happen with coarse grids causing snapped bounding boxes to expand beyond the intended region.
The changes include comprehensive test coverage with a parametrized test that validates both error scenarios using intentionally coarse grids.
Confidence Score: 4/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client participant ModePlaneAnalyzer participant get_conductor_bounding_boxes participant _get_isolated_conductors_as_shapely participant _filter_conductors_touching_sim_bounds participant _check_box_intersects_with_conductors Client->>ModePlaneAnalyzer: get_conductor_bounding_boxes(structures, grid, symmetry, sim_box) ModePlaneAnalyzer->>get_conductor_bounding_boxes: Process conductors get_conductor_bounding_boxes->>_get_isolated_conductors_as_shapely: Extract all conductors from structures _get_isolated_conductors_as_shapely-->>get_conductor_bounding_boxes: isolated_conductor_shapely (all conductors) get_conductor_bounding_boxes->>_filter_conductors_touching_sim_bounds: Filter conductors touching boundaries _filter_conductors_touching_sim_bounds-->>get_conductor_bounding_boxes: filtered_conductor_shapely (subset) Note over get_conductor_bounding_boxes: Generate bounding boxes from<br/>filtered_conductor_shapely loop For each bounding_box get_conductor_bounding_boxes->>_check_box_intersects_with_conductors: Check against isolated_conductor_shapely (NEW: uses ALL conductors) _check_box_intersects_with_conductors-->>get_conductor_bounding_boxes: intersection_detected alt Intersection detected get_conductor_bounding_boxes->>Client: Raise SetupError (conductor intersection) end end loop For each bounding_box alt Box extends outside mode plane bounds (NEW validation) get_conductor_bounding_boxes->>Client: Raise SetupError (extends outside bounds) end end get_conductor_bounding_boxes-->>Client: Return (bounding_boxes, filtered_conductor_shapely)