fix(FXC-4341): Fix scene::plot_structures_porperty for doping #3115
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.
Fix scene::plot_structures_porperty with property=doping when the doping is defined with SpatialDataArrays that don't have overlapping coordinates
Greptile Summary
This PR fixes a bug in the
plot_structures_propertymethod where plotting doping with SpatialDataArrays that have non-overlapping coordinates would fail. The fix addsbounds_error=Falseandfill_value=0to the interpolation kwargs, allowing out-of-bounds points to be handled gracefully by setting them to 0 instead of raising an error. This change follows the existing interpolation pattern used elsewhere in the codebase (monitor_data.py).Confidence Score: 5/5
bounds_error=Falseandfill_value=0to interpolation kwargs. This directly addresses the issue where scipy's RegularGridInterpolator would fail on out-of-bounds points. The implementation matches established patterns elsewhere in the codebase (monitor_data.py). The change is well-tested by existing test cases (test_plot_property) which specifically test plotting with SpatialDataArray doping. No new logic branches or complex code paths are introduced.Important Files Changed
plot_structures_propertyby addingbounds_error=Falseandfill_value=0to kwargs when interpolating doping data with non-overlapping coordinates. This prevents scipy's RegularGridInterpolator from raising errors for out-of-bounds points.Sequence Diagram
sequenceDiagram participant User participant plot_structures_property participant interp_method participant RegularGridInterpolator User->>plot_structures_property: Call with SpatialDataArray doping plot_structures_property->>plot_structures_property: Create 100x100 grid for plotting plot_structures_property->>interp_method: interp(**struct_coords, method="nearest", kwargs={...}) Note over interp_method: Before fix: bounds_error=True (default)<br/>Grid points may fall outside data bounds interp_method->>RegularGridInterpolator: Create interpolator (bounds_error=True) RegularGridInterpolator-->>interp_method: ValueError if out-of-bounds! Note over plot_structures_property: After fix: bounds_error=False interp_method->>RegularGridInterpolator: Create interpolator (bounds_error=False, fill_value=0) RegularGridInterpolator->>RegularGridInterpolator: Out-of-bounds points → fill_value=0 RegularGridInterpolator-->>interp_method: Interpolated data with zeros for out-of-bounds interp_method-->>plot_structures_property: Successfully interpolated data plot_structures_property-->>User: Plot rendered successfully