@@ -2029,6 +2029,7 @@ def plot_field(
2029
2029
vmin : Optional [float ] = None ,
2030
2030
vmax : Optional [float ] = None ,
2031
2031
ax : Ax = None ,
2032
+ swap_axes : bool = False ,
2032
2033
** sel_kwargs ,
2033
2034
) -> Ax :
2034
2035
"""Plot the field for a :class:`.ModeSolverData` with :class:`.Simulation` plot overlaid.
@@ -2080,12 +2081,14 @@ def plot_field(
2080
2081
vmin = vmin ,
2081
2082
vmax = vmax ,
2082
2083
ax = ax ,
2084
+ swap_axes = swap_axes ,
2083
2085
** sel_kwargs ,
2084
2086
)
2085
2087
2086
2088
def plot (
2087
2089
self ,
2088
2090
ax : Ax = None ,
2091
+ swap_axes : bool = False ,
2089
2092
** patch_kwargs ,
2090
2093
) -> Ax :
2091
2094
"""Plot the mode plane simulation's components.
@@ -2122,6 +2125,7 @@ def plot(
2122
2125
monitor_alpha = 0 ,
2123
2126
lumped_element_alpha = 0 ,
2124
2127
ax = ax ,
2128
+ swap_axes = swap_axes ,
2125
2129
** patch_kwargs ,
2126
2130
)
2127
2131
@@ -2132,6 +2136,7 @@ def plot_eps(
2132
2136
freq : Optional [float ] = None ,
2133
2137
alpha : Optional [float ] = None ,
2134
2138
ax : Ax = None ,
2139
+ swap_axes : bool = False ,
2135
2140
) -> Ax :
2136
2141
"""Plot the mode plane simulation's components.
2137
2142
The permittivity is plotted in grayscale based on its value at the specified frequency.
@@ -2179,6 +2184,7 @@ def plot_eps(
2179
2184
monitor_alpha = 0 ,
2180
2185
lumped_element_alpha = 0 ,
2181
2186
ax = ax ,
2187
+ swap_axes = swap_axes ,
2182
2188
)
2183
2189
2184
2190
def plot_structures_eps (
@@ -2188,6 +2194,7 @@ def plot_structures_eps(
2188
2194
cbar : bool = True ,
2189
2195
reverse : bool = False ,
2190
2196
ax : Ax = None ,
2197
+ swap_axes : bool = False ,
2191
2198
) -> Ax :
2192
2199
"""Plot the mode plane simulation's components.
2193
2200
The permittivity is plotted in grayscale based on its value at the specified frequency.
@@ -2239,11 +2246,13 @@ def plot_structures_eps(
2239
2246
hlim = h_lim ,
2240
2247
vlim = v_lim ,
2241
2248
ax = ax ,
2249
+ swap_axes = swap_axes ,
2242
2250
)
2243
2251
2244
2252
def plot_grid (
2245
2253
self ,
2246
2254
ax : Ax = None ,
2255
+ swap_axes : bool = False ,
2247
2256
** kwargs ,
2248
2257
) -> Ax :
2249
2258
"""Plot the mode plane cell boundaries as lines.
@@ -2269,7 +2278,7 @@ def plot_grid(
2269
2278
)
2270
2279
2271
2280
return self .simulation .plot_grid (
2272
- x = a_center [0 ], y = a_center [1 ], z = a_center [2 ], hlim = h_lim , vlim = v_lim , ax = ax , ** kwargs
2281
+ x = a_center [0 ], y = a_center [1 ], z = a_center [2 ], hlim = h_lim , vlim = v_lim , ax = ax , swap_axes = swap_axes , ** kwargs
2273
2282
)
2274
2283
2275
2284
@classmethod
@@ -2363,6 +2372,7 @@ def _mode_plane_size_no_pml(
2363
2372
def plot_pml (
2364
2373
self ,
2365
2374
ax : Ax = None ,
2375
+ swap_axes : bool = False ,
2366
2376
) -> Ax :
2367
2377
"""Plot the mode plane absorbing boundaries.
2368
2378
@@ -2377,16 +2387,16 @@ def plot_pml(
2377
2387
The supplied or created matplotlib axes.
2378
2388
"""
2379
2389
return self ._plot_pml (
2380
- simulation = self .simulation , plane = self .plane , mode_spec = self .mode_spec , ax = ax
2390
+ simulation = self .simulation , plane = self .plane , mode_spec = self .mode_spec , ax = ax , swap_axes = swap_axes
2381
2391
)
2382
2392
2383
2393
@classmethod
2384
2394
def _plot_pml (
2385
- cls , simulation : Simulation , plane : Box , mode_spec : ModeSpec , ax : Ax = None
2395
+ cls , simulation : Simulation , plane : Box , mode_spec : ModeSpec , ax : Ax = None , swap_axes : bool = False ,
2386
2396
) -> Ax :
2387
2397
"""Plot the mode plane absorbing boundaries."""
2388
2398
# Get the mode plane normal axis, center, and limits.
2389
- _ , h_lim , v_lim , _ = cls ._center_and_lims (simulation = simulation , plane = plane )
2399
+ _ , h_lim , v_lim , _ = cls ._center_and_lims (simulation = simulation , plane = plane , swap_axes = swap_axes )
2390
2400
2391
2401
# Create ax if ax=None.
2392
2402
if not ax :
@@ -2434,16 +2444,20 @@ def _plot_pml(
2434
2444
return ax
2435
2445
2436
2446
@staticmethod
2437
- def _center_and_lims (simulation : Simulation , plane : Box ) -> tuple [list , list , list , list ]:
2447
+ def _center_and_lims (
2448
+ simulation : Simulation ,
2449
+ plane : Box ,
2450
+ swap_axes : bool = False
2451
+ ) -> tuple [list , list , list , list ]:
2438
2452
"""Get the mode plane center and limits."""
2439
2453
normal_axis = plane .size .index (0.0 )
2440
2454
2441
- n_axis , t_axes = plane .pop_axis ([0 , 1 , 2 ], normal_axis )
2455
+ n_axis , t_axes = plane .pop_axis_and_swap ([0 , 1 , 2 ], normal_axis , swap_axes = swap_axes )
2442
2456
a_center = [None , None , None ]
2443
2457
a_center [n_axis ] = plane .center [n_axis ]
2444
2458
2445
- _ , (h_min_s , v_min_s ) = Box .pop_axis (simulation .bounds [0 ], axis = n_axis )
2446
- _ , (h_max_s , v_max_s ) = Box .pop_axis (simulation .bounds [1 ], axis = n_axis )
2459
+ _ , (h_min_s , v_min_s ) = Box .pop_axis_and_swap (simulation .bounds [0 ], axis = n_axis , swap_axes = swap_axes )
2460
+ _ , (h_max_s , v_max_s ) = Box .pop_axis_and_swap (simulation .bounds [1 ], axis = n_axis , swap_axes = swap_axes )
2447
2461
2448
2462
h_min = plane .center [t_axes [0 ]] - plane .size [t_axes [0 ]] / 2
2449
2463
h_max = plane .center [t_axes [0 ]] + plane .size [t_axes [0 ]] / 2
0 commit comments