|
31 | 31 | from tidy3d.components.simulation import Simulation |
32 | 32 | from tidy3d.components.structure import Structure |
33 | 33 | from tidy3d.components.subpixel_spec import Staircasing, SubpixelSpec |
34 | | -from tidy3d.components.types import Ax, annotate_type |
| 34 | +from tidy3d.components.types import Ax, discriminated_union |
35 | 35 | from tidy3d.constants import HERTZ, SECOND |
36 | 36 | from tidy3d.exceptions import AdjointError |
37 | 37 | from tidy3d.log import log |
|
69 | 69 | ) |
70 | 70 |
|
71 | 71 | OutputMonitorTypes = (DiffractionMonitor, FieldMonitor, ModeMonitor) |
72 | | -OutputMonitorType = tuple[annotate_type(Union[OutputMonitorTypes]), ...] |
| 72 | +OutputMonitorType = tuple[discriminated_union(Union[OutputMonitorTypes]), ...] |
73 | 73 |
|
74 | 74 |
|
75 | 75 | class JaxInfo(Tidy3dBaseModel): |
@@ -122,7 +122,7 @@ class JaxInfo(Tidy3dBaseModel): |
122 | 122 | class JaxSimulation(Simulation, JaxObject): |
123 | 123 | """A :class:`.Simulation` registered with jax.""" |
124 | 124 |
|
125 | | - input_structures: tuple[annotate_type(JaxStructureType), ...] = Field( |
| 125 | + input_structures: tuple[discriminated_union(JaxStructureType), ...] = Field( |
126 | 126 | (), |
127 | 127 | title="Input Structures", |
128 | 128 | description="Tuple of jax-compatible structures" |
@@ -164,7 +164,7 @@ class JaxSimulation(Simulation, JaxObject): |
164 | 164 | units=SECOND, |
165 | 165 | ) |
166 | 166 |
|
167 | | - @field_validator("output_monitors", always=True) |
| 167 | + @field_validator("output_monitors") |
168 | 168 | def _output_monitors_colocate_false(val): |
169 | 169 | """Make sure server-side colocation is off.""" |
170 | 170 | new_vals = [] |
|
0 commit comments