Skip to content

Commit 48a70df

Browse files
committed
Plotting fixes for background medium
1 parent b6f8bb2 commit 48a70df

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

tidy3d/components/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
# data
3838
from .data import SimulationData, FieldData, FluxData, ModeData, FluxTimeData
3939
from .data import ScalarFieldData, ScalarFieldTimeData, ModeAmpsData, ModeIndexData, DATA_TYPE_MAP
40-
from .data import ModeFieldData, PermittivityData
40+
from .data import ModeFieldData, PermittivityData

tidy3d/components/simulation.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,8 @@ def plot_structures(
677677
medium_map = self.medium_map
678678

679679
for (medium, shape) in medium_shapes:
680-
if medium != self.medium:
681-
mat_index = medium_map[medium]
682-
ax = self._plot_shape_structure(
683-
medium=medium, mat_index=mat_index, shape=shape, ax=ax
684-
)
680+
mat_index = medium_map[medium]
681+
ax = self._plot_shape_structure(medium=medium, mat_index=mat_index, shape=shape, ax=ax)
685682

686683
ax = self._set_plot_bounds(ax=ax, x=x, y=y, z=z)
687684

@@ -773,15 +770,19 @@ def plot_structures_eps( # pylint: disable=too-many-arguments,too-many-locals
773770
The supplied or created matplotlib axes.
774771
"""
775772

776-
structures = [self.background_structure] + self.structures
773+
structures = self.structures
774+
alpha_used = alpha is not None and 0 < alpha < 1
777775

778-
if alpha is not None and alpha < 1:
776+
if alpha_used:
779777
medium_shapes = self._filter_structures_plane(structures=structures, x=x, y=y, z=z)
780778
else:
779+
structures = [self.background_structure] + structures
781780
medium_shapes = self._get_structures_plane(structures=structures, x=x, y=y, z=z)
782781

783782
eps_min, eps_max = self.eps_bounds(freq=freq)
784783
for (medium, shape) in medium_shapes:
784+
if medium == self.medium and alpha_used:
785+
continue
785786
ax = self._plot_shape_structure_eps(
786787
freq=freq,
787788
alpha=alpha,

0 commit comments

Comments
 (0)