indentation & style

This commit is contained in:
Jan Petykiewicz 2025-01-14 21:59:12 -08:00
parent 50f92e1cc8
commit 4e3a163522

View File

@ -46,20 +46,24 @@ def test0(solver=generic_solver):
# #### Create the grid, mask, and draw the device #### # #### Create the grid, mask, and draw the device ####
grid = gridlock.Grid(edge_coords) grid = gridlock.Grid(edge_coords)
epsilon = grid.allocate(n_air**2, dtype=numpy.float32) epsilon = grid.allocate(n_air**2, dtype=numpy.float32)
grid.draw_cylinder(epsilon, grid.draw_cylinder(
surface_normal=2, epsilon,
center=center, surface_normal=2,
radius=max(radii), center=center,
thickness=th, radius=max(radii),
eps=n_ring**2, thickness=th,
num_points=24) foreground=n_ring**2,
grid.draw_cylinder(epsilon, num_points=24,
surface_normal=2, )
center=center, grid.draw_cylinder(
radius=min(radii), epsilon,
thickness=th*1.1, surface_normal=2,
eps=n_air ** 2, center=center,
num_points=24) radius=min(radii),
thickness=th*1.1,
foreground=n_air ** 2,
num_points=24,
)
dxes = [grid.dxyz, grid.autoshifted_dxyz()] dxes = [grid.dxyz, grid.autoshifted_dxyz()]
for a in (0, 1, 2): for a in (0, 1, 2):
@ -71,9 +75,9 @@ def test0(solver=generic_solver):
J[1][15, grid.shape[1]//2, grid.shape[2]//2] = 1 J[1][15, grid.shape[1]//2, grid.shape[2]//2] = 1
''' #
Solve! # Solve!
''' #
sim_args = { sim_args = {
'omega': omega, 'omega': omega,
'dxes': dxes, 'dxes': dxes,
@ -87,9 +91,9 @@ def test0(solver=generic_solver):
E = unvec(x, grid.shape) E = unvec(x, grid.shape)
''' #
Plot results # Plot results
''' #
pyplot.figure() pyplot.figure()
pyplot.pcolor(numpy.real(E[1][:, :, grid.shape[2]//2]), cmap='seismic') pyplot.pcolor(numpy.real(E[1][:, :, grid.shape[2]//2]), cmap='seismic')
pyplot.axis('equal') pyplot.axis('equal')
@ -169,9 +173,9 @@ def test1(solver=generic_solver):
# pcolor((numpy.abs(J3).sum(axis=2).sum(axis=0) > 0).astype(float).T) # pcolor((numpy.abs(J3).sum(axis=2).sum(axis=0) > 0).astype(float).T)
pyplot.show(block=True) pyplot.show(block=True)
''' #
Solve! # Solve!
''' #
sim_args = { sim_args = {
'omega': omega, 'omega': omega,
'dxes': dxes, 'dxes': dxes,
@ -188,9 +192,9 @@ def test1(solver=generic_solver):
E = unvec(x, grid.shape) E = unvec(x, grid.shape)
''' #
Plot results # Plot results
''' #
center = grid.pos2ind([0, 0, 0], None).astype(int) center = grid.pos2ind([0, 0, 0], None).astype(int)
pyplot.figure() pyplot.figure()
pyplot.subplot(2, 2, 1) pyplot.subplot(2, 2, 1)