@@ -291,15 +291,24 @@ def get_radiation_monitor_by_name(self, monitor_name: str) -> DirectivityMonitor
291
291
def run (self , path_dir : str = DEFAULT_DATA_DIR ):
292
292
"""Solves for the scattering matrix of the system."""
293
293
from tidy3d .plugins .smatrix .data .data import (
294
+ MicrowavePortSimulationData ,
294
295
MicrowaveSMatrixData ,
295
296
TerminalComponentModelerData ,
296
297
)
297
298
298
299
_ = self .get_path_dir (path_dir )
299
300
# _ = self._upload_terminal_modeler()
300
- batch_data = self ._construct_smatrix ()
301
- smatrix_data = MicrowaveSMatrixData (batch_data = batch_data )
302
- return TerminalComponentModelerData (simulation = self , data = smatrix_data )
301
+ terminal_port_data = self ._construct_smatrix ()
302
+
303
+ port_to_sim_data_map = {
304
+ port : self .simulation .batch_data [self .simulation ._task_name (port = port )]
305
+ for port in self .simulation .ports
306
+ }
307
+ port_simulation_data = MicrowavePortSimulationData (data = port_to_sim_data_map )
308
+ smatrix_data = MicrowaveSMatrixData (data = terminal_port_data )
309
+ return TerminalComponentModelerData (
310
+ simulation = self , smatrix_data = smatrix_data , port_simulation_data = port_simulation_data
311
+ )
303
312
304
313
##### Backwards compatibility methods #####
305
314
@staticmethod
@@ -342,7 +351,7 @@ def _monitor_data_at_port_amplitude(
342
351
343
352
smatrix_data = MicrowaveSMatrixData (data = self ._construct_smatrix ())
344
353
data = TerminalComponentModelerData (
345
- simulation = self , data = smatrix_data
354
+ simulation = self , smatrix_data = smatrix_data
346
355
)._monitor_data_at_port_amplitude (
347
356
port = port , sim_data = sim_data , monitor_data = monitor_data , a_port = a_port
348
357
)
@@ -356,7 +365,7 @@ def _port_reference_impedances(self, batch_data) -> PortDataArray:
356
365
357
366
smatrix_data = MicrowaveSMatrixData (data = self ._construct_smatrix ())
358
367
data = TerminalComponentModelerData (
359
- simulation = self , data = smatrix_data
368
+ simulation = self , smatrix_data = smatrix_data
360
369
).port_reference_impedances
361
370
return data
362
371
@@ -498,7 +507,7 @@ def get_antenna_metrics_data(
498
507
499
508
smatrix_data = MicrowaveSMatrixData (data = self ._construct_smatrix ())
500
509
data = TerminalComponentModelerData (
501
- simulation = self , data = smatrix_data
510
+ simulation = self , smatrix_data = smatrix_data
502
511
).get_antenna_metrics_data (port_amplitudes = port_amplitudes , monitor_name = monitor_name )
503
512
return data
504
513
@@ -514,7 +523,7 @@ def port_reference_impedances(self) -> PortDataArray:
514
523
515
524
smatrix_data = MicrowaveSMatrixData (data = self ._construct_smatrix ())
516
525
data = TerminalComponentModelerData (
517
- simulation = self , data = smatrix_data
526
+ simulation = self , smatrix_data = smatrix_data
518
527
).port_reference_impedances
519
528
return data
520
529
0 commit comments