@@ -1241,7 +1241,7 @@ def test_high_order_mode_normalization():
1241
1241
def test_mode_solver_angle_symmetry ():
1242
1242
# Angle to test
1243
1243
theta = np .pi / 180
1244
- theta = np .pi / 6
1244
+ # theta = np.pi / 6
1245
1245
1246
1246
# Other parameters
1247
1247
plane = td .Box (center = (0 , 0 , 0 ), size = (5 , 0 , 8 ))
@@ -1269,7 +1269,7 @@ def test_mode_solver_angle_symmetry():
1269
1269
# grid_spec=td.GridSpec.uniform(dl=0.04),
1270
1270
structures = [wg ],
1271
1271
run_time = 1e-12 ,
1272
- symmetry = (0 , 0 , - 1 ),
1272
+ symmetry = (- 1 , 0 , 0 ),
1273
1273
sources = [src ],
1274
1274
# medium=td.Medium(permittivity=4.5),
1275
1275
)
@@ -1295,13 +1295,13 @@ def test_mode_solver_angle_symmetry():
1295
1295
ms_angle = ms .updated_copy (mode_spec = mode_spec , simulation = simulation )
1296
1296
modes_angle = ms_angle .solve ()
1297
1297
1298
- import matplotlib .pyplot as plt
1298
+ # import matplotlib.pyplot as plt
1299
1299
1300
- fig , ax = plt .subplots (1 , 3 )
1301
- simulation .plot (x = 0 , ax = ax [0 ])
1302
- simulation .plot (y = 0 , ax = ax [1 ])
1303
- simulation .plot (z = 0 , ax = ax [2 ])
1304
- plt .show ()
1300
+ # fig, ax = plt.subplots(1, 3)
1301
+ # simulation.plot(x=0, ax=ax[0])
1302
+ # simulation.plot(y=0, ax=ax[1])
1303
+ # simulation.plot(z=0, ax=ax[2])
1304
+ # plt.show()
1305
1305
1306
1306
# Plot the mode_index = 0 mode for both
1307
1307
_ , ax = plt .subplots (1 , 2 )
@@ -1312,7 +1312,10 @@ def test_mode_solver_angle_symmetry():
1312
1312
print (modes_zero .n_complex .values )
1313
1313
print (modes_angle .n_complex .values )
1314
1314
1315
- assert np .allclose (modes_zero .n_complex .values , modes_angle .n_complex .values , atol = 3e-2 )
1315
+ # Modes with and without an angle are close
1316
+ assert np .allclose (modes_zero .n_complex .values , modes_angle .n_complex .values , atol = 2e-2 )
1317
+ # Modes with angle (tensorial mode solver) have a small k_eff
1318
+ assert np .all (np .abs (modes_angle .k_eff ) < 1e-10 )
1316
1319
1317
1320
1318
1321
def test_gauge_robustness ():
@@ -1364,3 +1367,7 @@ def test_translated_dot():
1364
1367
1365
1368
assert np .allclose (data2 .outer_dot (data_translated ), data2 .outer_dot (data2 ), atol = atol )
1366
1369
assert np .allclose (data_translated .outer_dot (data2 ), data2 .outer_dot (data2 ), atol = atol )
1370
+
1371
+
1372
+ if __name__ == "__main__" :
1373
+ test_mode_solver_angle_symmetry ()
0 commit comments