Skip to content

Commit 7faf00f

Browse files
committed
Fixed some bugs in HeatChargeSimulation.plot_sources(). It runs without crashing with the default argument (swap_axes=False). But it does not produce the correct graphical result when swap_axes=True.
1 parent b38ca42 commit 7faf00f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tidy3d/components/tcad/simulation/heat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def plot_heat_conductivity(
7070
colorbar: str = "conductivity",
7171
hlim: Optional[tuple[float, float]] = None,
7272
vlim: Optional[tuple[float, float]] = None,
73+
swap_axes: bool = False
7374
) -> Ax:
7475
"""Plot each of simulation's components on a plane defined by one nonzero x,y,z coordinate.
7576
@@ -121,4 +122,5 @@ def plot_heat_conductivity(
121122
property=plot_type,
122123
hlim=hlim,
123124
vlim=vlim,
125+
swap_axes=swap_axes,
124126
)

tidy3d/components/tcad/simulation/heat_charge.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ def plot_boundaries(
11901190
]
11911191

11921192
for bc_spec, shape in new_boundaries:
1193-
ax = self._plot_boundary_condition(shape=shape, boundary_spec=bc_spec, ax=ax, swap_axes=swap_axes)
1193+
ax = self._plot_boundary_condition(shape=shape, boundary_spec=bc_spec, ax=ax)
11941194

11951195
# clean up the axis display
11961196
ax = self.add_ax_lims(axis=axis, ax=ax, swap_axes=swap_axes)
@@ -1220,11 +1220,11 @@ def _get_bc_plot_params(self, boundary_spec: HeatChargeBoundarySpec) -> PlotPara
12201220
return plot_params
12211221

12221222
def _plot_boundary_condition(
1223-
self, shape: Shapely, boundary_spec: HeatChargeBoundarySpec, ax: Ax, swap_axes: bool = False
1223+
self, shape: Shapely, boundary_spec: HeatChargeBoundarySpec, ax: Ax
12241224
) -> Ax:
12251225
"""Plot a structure's cross section shape for a given boundary condition."""
12261226
plot_params_bc = self._get_bc_plot_params(boundary_spec=boundary_spec)
1227-
ax = self.plot_shape(shape=shape, plot_params=plot_params_bc, ax=ax, swap_axes=swap_axes)
1227+
ax = self.plot_shape(shape=shape, plot_params=plot_params_bc, ax=ax)
12281228
return ax
12291229

12301230
@staticmethod
@@ -1454,6 +1454,7 @@ def _construct_heat_charge_boundaries(
14541454
structures: list[Structure],
14551455
plane: Box,
14561456
boundary_spec: list[HeatChargeBoundarySpec],
1457+
swap_axes: bool = False,
14571458
) -> list[tuple[HeatChargeBoundarySpec, Shapely]]:
14581459
"""Compute list of boundary lines to plot on plane.
14591460
@@ -1476,7 +1477,7 @@ def _construct_heat_charge_boundaries(
14761477
shapes = [] # structure name, structure medium, shape, bounds
14771478
for structure in structures:
14781479
# get list of Shapely shapes that intersect at the plane
1479-
shapes_plane = plane.intersections_with(structure.geometry)
1480+
shapes_plane = plane.intersections_with(structure.geometry, swap_axes=swap_axes)
14801481

14811482
# append each of them and their medium information to the list of shapes
14821483
for shape in shapes_plane:
@@ -1600,7 +1601,6 @@ def plot_sources(
16001601
source_max=source_max,
16011602
shape=shape,
16021603
ax=ax,
1603-
swap_axes=swap_axes,
16041604
)
16051605

16061606
# clean up the axis display

0 commit comments

Comments
 (0)