28
28
AbstractComponentModeler ,
29
29
TerminalPortType ,
30
30
)
31
- from tidy3d .plugins .smatrix .data .terminal import PortDataArray , TerminalPortDataArray
31
+ from tidy3d .plugins .smatrix .data .data_array import PortDataArray , TerminalPortDataArray
32
32
from tidy3d .plugins .smatrix .ports .base_lumped import AbstractLumpedPort
33
33
from tidy3d .plugins .smatrix .ports .coaxial_lumped import CoaxialLumpedPort
34
34
from tidy3d .plugins .smatrix .ports .rectangular_lumped import LumpedPort
@@ -304,6 +304,7 @@ def run(self, path_dir: str = DEFAULT_DATA_DIR):
304
304
##### Backwards compatibility methods #####
305
305
@staticmethod
306
306
def _check_port_impedance_sign (Z_numpy : np .ndarray ):
307
+ """Sanity check for consistent sign of real part of Z for each port across all frequencies."""
307
308
from tidy3d .plugins .smatrix .utils import check_port_impedance_sign
308
309
309
310
return check_port_impedance_sign (Z_numpy )
@@ -317,6 +318,7 @@ def _compute_F(Z_numpy: np.array):
317
318
return compute_F (Z_numpy )
318
319
319
320
def _construct_smatrix (self ) -> TerminalPortDataArray :
321
+ """Post process :class:`.BatchData` to generate scattering matrix."""
320
322
from tidy3d .plugins .smatrix .local_run import construct_smatrix
321
323
322
324
return construct_smatrix (self )
@@ -387,6 +389,7 @@ def _upload_terminal_modeler(self):
387
389
def ab_to_s (
388
390
a_matrix : TerminalPortDataArray , b_matrix : TerminalPortDataArray
389
391
) -> TerminalPortDataArray :
392
+ """Get the scattering matrix given the power wave matrices."""
390
393
from tidy3d .plugins .smatrix .utils import ab_to_s
391
394
392
395
return ab_to_s (a_matrix = a_matrix , b_matrix = b_matrix )
@@ -395,13 +398,42 @@ def ab_to_s(
395
398
def compute_port_VI (
396
399
port_out : TerminalPortType , sim_data : SimulationData
397
400
) -> tuple [FreqDataArray , FreqDataArray ]:
401
+ """Compute the port voltages and currents.
402
+
403
+ Parameters
404
+ ----------
405
+ port_out : ``TerminalPortType``
406
+ Port for computing voltage and current.
407
+ sim_data : :class:`.SimulationData`
408
+ Results from simulation containing field data.
409
+
410
+ Returns
411
+ -------
412
+ tuple[FreqDataArray, FreqDataArray]
413
+ Voltage and current values at the port as frequency arrays.
414
+ """
398
415
from tidy3d .plugins .smatrix .utils import compute_port_VI
399
416
400
417
return compute_port_VI (port_out = port_out , sim_data = sim_data )
401
418
402
419
def compute_power_wave_amplitudes_at_each_port (
403
420
self , port_reference_impedances : PortDataArray , sim_data : SimulationData
404
421
) -> tuple [PortDataArray , PortDataArray ]:
422
+ """Compute the incident and reflected power wave amplitudes at each port.
423
+ The computed amplitudes have not been normalized.
424
+
425
+ Parameters
426
+ ----------
427
+ port_reference_impedances : :class:`.PortDataArray`
428
+ Reference impedance at each port.
429
+ sim_data : :class:`.SimulationData`
430
+ Results from the simulation.
431
+
432
+ Returns
433
+ -------
434
+ tuple[:class:`.PortDataArray`, :class:`.PortDataArray`]
435
+ Incident (a) and reflected (b) power wave amplitudes at each port.
436
+ """
405
437
from tidy3d .plugins .smatrix .local_run import compute_power_wave_amplitudes_at_each_port
406
438
407
439
data = compute_power_wave_amplitudes_at_each_port (
@@ -413,6 +445,20 @@ def compute_power_wave_amplitudes_at_each_port(
413
445
def compute_power_delivered_by_port (
414
446
port : Union [LumpedPort , CoaxialLumpedPort ], sim_data : SimulationData
415
447
) -> FreqDataArray :
448
+ """Compute the power delivered to the network by a lumped port.
449
+
450
+ Parameters
451
+ ----------
452
+ port : Union[:class:`.LumpedPort`, :class:`.CoaxialLumpedPort`]
453
+ Port for computing voltage and current.
454
+ sim_data : :class:`.SimulationData`
455
+ Results from the simulation.
456
+
457
+ Returns
458
+ -------
459
+ FreqDataArray
460
+ Power in units of Watts as a frequency array.
461
+ """
416
462
from tidy3d .plugins .smatrix .utils import compute_power_delivered_by_port
417
463
418
464
return compute_power_delivered_by_port (port = port , sim_data = sim_data )
@@ -421,6 +467,21 @@ def compute_power_delivered_by_port(
421
467
def compute_power_wave_amplitudes (
422
468
port : Union [LumpedPort , CoaxialLumpedPort ], sim_data : SimulationData
423
469
) -> tuple [FreqDataArray , FreqDataArray ]:
470
+ """Compute the incident and reflected power wave amplitudes at a lumped port.
471
+ The computed amplitudes have not been normalized.
472
+
473
+ Parameters
474
+ ----------
475
+ port : Union[:class:`.LumpedPort`, :class:`.CoaxialLumpedPort`]
476
+ Port for computing voltage and current.
477
+ sim_data : :class:`.SimulationData`
478
+ Results from the simulation.
479
+
480
+ Returns
481
+ -------
482
+ tuple[FreqDataArray, FreqDataArray]
483
+ Incident (a) and reflected (b) power wave amplitude frequency arrays.
484
+ """
424
485
from tidy3d .plugins .smatrix .utils import compute_power_wave_amplitudes
425
486
426
487
return compute_power_wave_amplitudes (port = port , sim_data = sim_data )
@@ -443,6 +504,9 @@ def get_antenna_metrics_data(
443
504
444
505
@cached_property
445
506
def port_reference_impedances (self ) -> PortDataArray :
507
+ """Tabulates the reference impedance of each port at each frequency using the
508
+ supplied :class:`.BatchData`.
509
+ """
446
510
from tidy3d .plugins .smatrix .data .data import (
447
511
MicrowaveSMatrixData ,
448
512
TerminalComponentModelerData ,
@@ -458,6 +522,7 @@ def port_reference_impedances(self) -> PortDataArray:
458
522
def s_to_z (
459
523
s_matrix : TerminalPortDataArray , reference : Union [complex , PortDataArray ]
460
524
) -> DataArray :
525
+ """Get the impedance matrix given the scattering matrix and a reference impedance."""
461
526
from tidy3d .plugins .smatrix .utils import s_to_z
462
527
463
528
return s_to_z (s_matrix = s_matrix , reference = reference )
0 commit comments