diff --git a/tests/test_components/test_autograd.py b/tests/test_components/test_autograd.py index 153fd5115..7dad1fab0 100644 --- a/tests/test_components/test_autograd.py +++ b/tests/test_components/test_autograd.py @@ -71,12 +71,16 @@ IS_3D = False -# TODO: test 2D and 3D parameterized +# angle of the measurement waveguide +ROT_ANGLE_WG = 0 * np.pi / 4 + +# position of output mode monitor +MODE_FIELD_SPC = 0.75 +MODE_FLD_MNT_SPC = MODE_FIELD_SPC * WVL LX = 0.5 * WVL if IS_3D else 0.0 PML_X = True if IS_3D else False - # shape of the custom medium DA_SHAPE_X = 1 if IS_3D else 1 DA_SHAPE = (DA_SHAPE_X, 1_000, 1_000) if TEST_CUSTOM_MEDIUM_SPEED else (DA_SHAPE_X, 12, 12) @@ -114,8 +118,10 @@ td.Structure( geometry=td.Box( size=(0.5, 0.5, LZ / 2), - center=(0, 0, LZ / 2), - ), + center=(0, 0, 0), + ) + .rotated(ROT_ANGLE_WG, axis=0) + .translated(x=0, y=-np.tan(ROT_ANGLE_WG) * MODE_FIELD_SPC, z=LZ / 2), medium=td.Medium(permittivity=2.0), ) ], @@ -433,12 +439,13 @@ def make_structures(params: anp.ndarray) -> dict[str, td.Structure]: def make_monitors() -> dict[str, tuple[td.Monitor, typing.Callable[[td.SimulationData], float]]]: """Make a dictionary of all the possible monitors in the simulation.""" - X = 0.75 - mode_mnt = td.ModeMonitor( size=(2, 2, 0), - center=(0, 0, +LZ / 2 - X * WVL), - mode_spec=td.ModeSpec(), + center=(0, 0, +LZ / 2 - MODE_FIELD_SPC), + mode_spec=td.ModeSpec( + angle_theta=ROT_ANGLE_WG, + angle_phi=3 * np.pi / 2, + ), freqs=[FREQ0], name="mode", ) @@ -459,7 +466,7 @@ def diff_postprocess_fn(sim_data, mnt_data): field_vol = td.FieldMonitor( size=(1, 1, 0), - center=(0, 0, +LZ / 2 - X * WVL), + center=(0, 0, +LZ / 2 - MODE_FIELD_SPC), freqs=[FREQ0], name="field_vol", ) diff --git a/tidy3d/web/api/autograd/autograd.py b/tidy3d/web/api/autograd/autograd.py index f34ab5775..e2b10cdc1 100644 --- a/tidy3d/web/api/autograd/autograd.py +++ b/tidy3d/web/api/autograd/autograd.py @@ -31,12 +31,6 @@ SIM_VJP_FILE = "output/autograd_sim_vjp.hdf5" SIM_FIELDS_KEYS_FILE = "autograd_sim_fields_keys.hdf5" -ISSUE_URL = ( - "https://github.com/flexcompute/tidy3d/issues/new?" - "assignees=tylerflex&labels=adjoint&projects=&template=autograd_bug.md" -) -URL_LINK = f"[blue underline][link={ISSUE_URL}]'{ISSUE_URL}'[/link][/blue underline]" - MAX_NUM_TRACED_STRUCTURES = 500 # default value for whether to do local gradient calculation (True) or server side (False)