Skip to content

Commit

Permalink
saving indentations
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerflex committed Mar 30, 2022
1 parent 4dd7fc7 commit 687e578
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions tidy3d/components/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,26 +230,28 @@ def plotly_sim(sim, x=None, y=None, z=None):
geo = struct.geometry
shapes = geo.intersections(x=x, y=y, z=z)

if len(shapes) > 0:
mat_index = sim.medium_map[struct.medium]
params = StructMediumParams(medium=struct.medium, medium_map=sim.medium_map)
color = params.get_plot_params().facecolor
if len(shapes) == 0:
continue

for shape in shapes:
xs, ys = shape.exterior.coords.xy
xs = xs.tolist()
ys = ys.tolist()
mat_index = sim.medium_map[struct.medium]
params = StructMediumParams(medium=struct.medium, medium_map=sim.medium_map)
color = params.get_plot_params().facecolor

plotly_trace = go.Scatter(
x=xs,
y=ys,
fill="toself",
fillcolor=color,
line=dict(width=0),
marker=dict(size=0.0001, line=dict(width=0)),
name=struct.medium.name if struct.medium.name else f"medium[{mat_index}]",
)
fig.add_trace(plotly_trace)
for shape in shapes:
xs, ys = shape.exterior.coords.xy
xs = xs.tolist()
ys = ys.tolist()

plotly_trace = go.Scatter(
x=xs,
y=ys,
fill="toself",
fillcolor=color,
line=dict(width=0),
marker=dict(size=0.0001, line=dict(width=0)),
name=struct.medium.name if struct.medium.name else f"medium[{mat_index}]",
)
fig.add_trace(plotly_trace)

for i, source in enumerate(sim.sources):
geo = source.geometry
Expand Down

0 comments on commit 687e578

Please sign in to comment.