2323import matplotlib .pyplot as plt
2424import numpy as np
2525import tidy3d as td
26+ import tidy3d .web as web
2627from gdsfactory .component import Component
2728from gdsfactory .pdk import get_layer_stack
2829from gdsfactory .technology import LayerStack
@@ -227,7 +228,7 @@ def get_component_modeler(
227228 run_only : tuple [tuple [str , int ], ...] | None = None ,
228229 element_mappings : Tidy3DElementMapping = (),
229230 extra_monitors : tuple [Any , ...] | None = None ,
230- mode_spec : td .ModeSpec = td .ModeSpec (num_modes = 1 , filter_pol = "te" ),
231+ mode_spec : td .ModeSpec = td .ModeSpec (num_modes = 1 ),
231232 boundary_spec : td .BoundarySpec = td .BoundarySpec .all_sides (boundary = td .PML ()),
232233 run_time : float = 10e-12 ,
233234 shutoff : float = 1e-5 ,
@@ -251,7 +252,7 @@ def get_component_modeler(
251252 run_only: The run only specification for the ComponentModeler. Defaults to None.
252253 element_mappings: The element mappings for the ComponentModeler. Defaults to ().
253254 extra_monitors: The extra monitors for the ComponentModeler. Defaults to None.
254- mode_spec: The mode specification for the ComponentModeler. Defaults to td.ModeSpec(num_modes=1, filter_pol="te" ).
255+ mode_spec: The mode specification for the ComponentModeler. Defaults to td.ModeSpec(num_modes=1).
255256 boundary_spec: The boundary specification for the ComponentModeler. Defaults to td.BoundarySpec.all_sides(boundary=td.PML()).
256257 run_time: The run time for the ComponentModeler.
257258 shutoff: The shutoff value for the ComponentModeler. Defaults to 1e-5.
@@ -308,9 +309,6 @@ def get_component_modeler(
308309 freqs = tuple (freqs ),
309310 element_mappings = element_mappings ,
310311 run_only = run_only ,
311- folder_name = folder_name ,
312- path_dir = path_dir ,
313- verbose = verbose ,
314312 )
315313
316314 @td .components .viz .add_ax_if_none
@@ -428,7 +426,7 @@ def write_sparameters(
428426 run_only : tuple [tuple [str , int ], ...] | None = None ,
429427 element_mappings : Tidy3DElementMapping = (),
430428 extra_monitors : tuple [Any , ...] | None = None ,
431- mode_spec : td .ModeSpec = td .ModeSpec (num_modes = 1 , filter_pol = "te" ),
429+ mode_spec : td .ModeSpec = td .ModeSpec (num_modes = 1 ),
432430 boundary_spec : td .BoundarySpec = td .BoundarySpec .all_sides (boundary = td .PML ()),
433431 symmetry : tuple [Symmetry , Symmetry , Symmetry ] = (0 , 0 , 0 ),
434432 run_time : float = 1e-12 ,
@@ -471,7 +469,7 @@ def write_sparameters(
471469 run_only: The run only specification for the ComponentModeler. Defaults to None.
472470 element_mappings: The element mappings for the ComponentModeler. Defaults to ().
473471 extra_monitors: The extra monitors for the ComponentModeler. Defaults to None.
474- mode_spec: The mode specification for the ComponentModeler. Defaults to td.ModeSpec(num_modes=1, filter_pol="te" ).
472+ mode_spec: The mode specification for the ComponentModeler. Defaults to td.ModeSpec(num_modes=1).
475473 boundary_spec: The boundary specification for the ComponentModeler.
476474 Defaults to td.BoundarySpec.all_sides(boundary=td.PML()).
477475 symmetry (tuple[Symmetry, Symmetry, Symmetry], optional): The symmetry for the simulation. Defaults to (0,0,0).
@@ -522,14 +520,12 @@ def write_sparameters(
522520 boundary_spec = boundary_spec ,
523521 run_time = run_time ,
524522 shutoff = shutoff ,
525- folder_name = folder_name ,
526- verbose = verbose ,
527523 symmetry = symmetry ,
528524 ** kwargs ,
529525 )
530526
531527 path_dir = pathlib .Path (dirpath ) / modeler ._hash_self ()
532- modeler = modeler .updated_copy (path_dir = str ( path_dir ) )
528+ modeler = modeler .updated_copy ()
533529
534530 sp = {}
535531
@@ -591,7 +587,8 @@ def write_sparameters(
591587 return dict (np .load (filepath ))
592588 else :
593589 time .sleep (0.2 )
594- s = modeler .run ()
590+ modeler_data = web .run (modeler , verbose = verbose , path = dirpath / "simulation.hdf5" )
591+ s = modeler_data .smatrix ()
595592 for port_in in s .port_in .values :
596593 for port_out in s .port_out .values :
597594 for mode_index_in in s .mode_index_in .values :
@@ -645,7 +642,7 @@ def write_sparameters_batch(
645642 run_only: The run only specification for the ComponentModeler. Defaults to None.
646643 element_mappings: The element mappings for the ComponentModeler. Defaults to ().
647644 extra_monitors: The extra monitors for the ComponentModeler. Defaults to None.
648- mode_spec: The mode specification for the ComponentModeler. Defaults to td.ModeSpec(num_modes=1, filter_pol="te" ).
645+ mode_spec: The mode specification for the ComponentModeler. Defaults to td.ModeSpec(num_modes=1).
649646 boundary_spec: The boundary specification for the ComponentModeler.
650647 Defaults to td.BoundarySpec.all_sides(boundary=td.PML()).
651648 symmetry (tuple[Symmetry, Symmetry, Symmetry], optional): The symmetry for the simulation. Defaults to (0,0,0).
0 commit comments