File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
tidy3d/plugins/adjoint/components Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
### Changed
12
12
13
13
### Fixed
14
+ - Properly handle ` .freqs ` in ` output_monitors ` of adjoint plugin.
14
15
15
16
## [ 2.4.2] - 2023-9-28
16
17
Original file line number Diff line number Diff line change @@ -52,18 +52,23 @@ def fix_polyslab(geo_dict: dict) -> None:
52
52
fix_polyslab (geo_dict ["geometry_a" ])
53
53
fix_polyslab (geo_dict ["geometry_b" ])
54
54
55
+ def fix_monitor (mnt_dict : dict ) -> None :
56
+ """Fix a frequency containing monitor."""
57
+ if "freqs" in mnt_dict :
58
+ freqs = mnt_dict ["freqs" ]
59
+ if isinstance (freqs , np .ndarray ):
60
+ mnt_dict ["freqs" ] = freqs .tolist ()
61
+
55
62
# fixes bug with jax handling 2D numpy array in polyslab vertices
56
63
if aux_data .get ("type" , "" ) == "JaxSimulation" :
57
64
structures = aux_data ["structures" ]
58
65
for _i , structure in enumerate (structures ):
59
66
geometry = structure ["geometry" ]
60
67
fix_polyslab (geometry )
61
- monitors = aux_data ["monitors" ]
62
- for _i , monitor in enumerate (monitors ):
63
- if "freqs" in monitor :
64
- freqs = monitor ["freqs" ]
65
- if isinstance (freqs , np .ndarray ):
66
- monitor ["freqs" ] = freqs .tolist ()
68
+ for monitor in aux_data ["monitors" ]:
69
+ fix_monitor (monitor )
70
+ for monitor in aux_data ["output_monitors" ]:
71
+ fix_monitor (monitor )
67
72
68
73
return children , aux_data
69
74
You can’t perform that action at this time.
0 commit comments