tidy3d.plugins.smatrix.TerminalComponentModelerData#
- class TerminalComponentModelerData[source]#
Bases:
AbstractComponentModelerDataData associated with a
TerminalComponentModelersimulation run.- Parameters:
attrs (dict = {}) β Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields,
attrsare mutable. For example, the following is allowed for setting anattrobj.attrs['foo'] = bar. Also note that Tidy3D` will raise aTypeErrorifattrscontain objects that can not be serialized. One can check ifattrsare serializable by callingobj.json().modeler (TerminalComponentModeler) β The original
TerminalComponentModelerobject that defines the simulation setup and from which this data was generated.data (SimulationDataMap) β A mapping from task names to
SimulationDataobjects, containing the results of each simulation run.log (Optional[str] = None) β A string containing the log information from the modeler post-processing run.
simulation (This class serves as a data container for the results of a component modeler)
:param : :param with the original simulation definition: :param and port simulation data: :param and the solver log.:
Notes
References
See also
tidy3d.plugins.smatrix.utils.ab_to_s(),tidy3d.plugins.smatrix.utils.check_port_impedance_sign(),tidy3d.plugins.smatrix.utils.compute_F(),tidy3d.plugins.smatrix.utils.compute_port_VI(),tidy3d.plugins.smatrix.utils.compute_power_delivered_by_port(),tidy3d.plugins.smatrix.utils.compute_power_wave_amplitudes(),tidy3d.plugins.smatrix.utils.s_to_z()Attributes
Calculates the reference impedance for each port across all frequencies.
dataMethods
ab_to_s(b_matrix)Get the scattering matrix given the wave amplitude matrices.
Sanity check for consistent sign of real part of Z for each port.
compute_F([s_param_def])Helper to convert port impedance matrix to F, which is used for computing scattering parameters
compute_port_VI(sim_data)Compute the port voltages and currents.
compute_power_delivered_by_port(sim_data)Compute the power delivered to the network by a lumped port.
compute_power_wave_amplitudes(sim_data)Calculates the unnormalized power wave amplitudes from port voltage (V), current (I), and impedance (Z0) using:
Compute the incident and reflected power wave amplitudes at each port.
compute_wave_amplitudes_at_each_port(...[,Β ...])Compute the incident and reflected amplitudes at each port.
get_antenna_metrics_data([port_amplitudes,Β ...])Calculate antenna parameters using superposition of fields from multiple port excitations.
s_to_z(reference[,Β s_param_def])Get the impedance matrix given the scattering matrix and a reference impedance.
smatrix([assume_ideal_excitation,Β s_param_def])Computes and returns the S-matrix and port reference impedances.
Inherited Common Usage
- modeler#
- smatrix(assume_ideal_excitation=None, s_param_def=None)[source]#
Computes and returns the S-matrix and port reference impedances.
- Parameters:
assume_ideal_excitation (If
True, assumes that exciting one port) β does not produce incident waves at other ports. This simplifies the S-matrix calculation and is required if not all ports are excited. If not provided,modeler.assume_ideal_excitationis used.s_param_def (The definition of S-parameters to use, determining whether) β βpseudo wavesβ or βpower wavesβ are calculated. If not provided,
modeler.s_param_defis used.
- Returns:
Container with the computed S-parameters and the port reference impedances.
- Return type:
- get_antenna_metrics_data(port_amplitudes=None, monitor_name=None)[source]#
Calculate antenna parameters using superposition of fields from multiple port excitations.
The method computes the radiated far fields and port excitation power wave amplitudes for a superposition of port excitations, which can be used to analyze antenna radiation characteristics.
- port_amplitudesdict[str, complex] = None
Dictionary mapping port names to their desired excitation amplitudes,
a. For each port, :math:`
- rac{1}{2}|a|^2` represents the incident power from that port into the system.
If
None, uses only the first port without any scaling of the raw simulation data. WhenNoneis passed as a port amplitude, the raw simulation data is used for that port. Note that in this methodarepresents the incident wave amplitude using the power wave definition in [2].- monitor_namestr = None
Name of the
DirectivityMonitorto use for calculating far fields. If None, uses the first monitor in radiation_monitors.
AntennaMetricsDataContainer with antenna parameters including directivity, gain, and radiation efficiency, computed from the superposition of fields from all excited ports.
- property port_reference_impedances#
Calculates the reference impedance for each port across all frequencies.
This function determines the characteristic impedance for every port defined in the modeler. It handles two types of ports differently: for a
WavePort, the impedance is frequency-dependent and computed from modal properties, while for other types likeLumpedPort, the impedance is a user-defined constant value.- Returns:
A data array containing the complex impedance for each port at each frequency.
- compute_wave_amplitudes_at_each_port(port_reference_impedances, sim_data, s_param_def='pseudo')[source]#
Compute the incident and reflected amplitudes at each port. The computed amplitudes have not been normalized.
- Parameters:
port_reference_impedances (
PortDataArray) β Reference impedance at each port.sim_data (
SimulationData) β Results from the simulation.s_param_def (SParamDef) β The type of waves computed, either pseudo waves defined by Equation 53 and Equation 54 in [1], or power waves defined by Equation 4.67 in [2].
- Returns:
Incident (a) and reflected (b) wave amplitudes at each port.
- Return type:
tuple[
PortDataArray,PortDataArray]
- compute_power_wave_amplitudes_at_each_port(port_reference_impedances, sim_data)[source]#
Compute the incident and reflected power wave amplitudes at each port. The computed amplitudes have not been normalized.
- Parameters:
port_reference_impedances (
PortDataArray) β Reference impedance at each port.sim_data (
SimulationData) β Results from the simulation.
- Returns:
Incident (a) and reflected (b) power wave amplitudes at each port.
- Return type:
tuple[
PortDataArray,PortDataArray]
- ab_to_s(b_matrix)#
Get the scattering matrix given the wave amplitude matrices.
- Parameters:
a_matrix (TerminalPortDataArray) β Matrix of incident power wave amplitudes.
b_matrix (TerminalPortDataArray) β Matrix of reflected power wave amplitudes.
- Returns:
The computed scattering (S) matrix.
- Return type:
- compute_F(s_param_def='pseudo')#
Helper to convert port impedance matrix to F, which is used for computing scattering parameters
The matrix F is used when converting between S and Z parameters for circuits with differing port impedances. Its diagonal elements are defined as \(F_{kk} = 1 / (2 * \sqrt{Re(Z_k)})\).
- Parameters:
Z_numpy (ArrayFloat1D) β NumPy array of complex port impedances.
s_param_def (SParamDef, optional) β The type of wave amplitudes, by default βpseudoβ.
- Returns:
NumPy array containing the computed F values.
- Return type:
ArrayFloat1D
- check_port_impedance_sign()#
Sanity check for consistent sign of real part of Z for each port.
This check iterates through each port and ensures that the sign of the real part of its impedance does not change across all frequencies. A sign change can indicate an unphysical result or numerical instability.
- Parameters:
Z_numpy (np.ndarray) β NumPy array of impedance values with shape (num_freqs, num_ports).
- Raises:
Tidy3dError β If an inconsistent sign of the real part of the impedance is detected for any port.
- compute_port_VI(sim_data)#
Compute the port voltages and currents.
- Parameters:
port_out (
TerminalPortType) β Port for computing voltage and current.sim_data (
SimulationData) β Results from simulation containing field data.
- Returns:
Voltage and current values at the port as frequency arrays.
- Return type:
tuple[PortVoltageType, PortCurrentType]
- compute_power_wave_amplitudes(sim_data)#
Calculates the unnormalized power wave amplitudes from port voltage (V), current (I), and impedance (Z0) using:
\[a = (V + Z0*I) / (2 * sqrt(Re(Z0))) b = (V - Z0*I) / (2 * sqrt(Re(Z0)))\]- Parameters:
port (
LumpedPortType) β Port for computing voltage and current.sim_data (
SimulationData) β Results from the simulation.
- Returns:
Incident (a) and reflected (b) power wave amplitude frequency arrays.
- Return type:
tuple[FreqDataArray, FreqDataArray]
- compute_power_delivered_by_port(sim_data)#
Compute the power delivered to the network by a lumped port.
The power is calculated as the incident power minus the reflected power: P = 0.5 * (|a|^2 - |b|^2).
- Parameters:
port (
LumpedPortType) β Port for computing voltage and current.sim_data (
SimulationData) β Results from the simulation.
- Returns:
Power in units of Watts as a frequency array.
- Return type:
FreqDataArray
- s_to_z(reference, s_param_def='pseudo')#
Get the impedance matrix given the scattering matrix and a reference impedance.
This function converts an S-matrix to a Z-matrix. It handles both a single uniform reference impedance and generalized per-port reference impedances.
- Parameters:
s_matrix (
TerminalPortDataArray) β Scattering matrix computed using either the pseudo or power wave formulation.reference (Union[complex,
PortDataArray]) β The reference impedance used at each port.s_param_def (SParamDef, optional) β The type of wave amplitudes used for computing the scattering matrix, either pseudo waves defined by Equation 53 and Equation 54 in [1] or power waves defined by Equation 4.67 in [2]. By default βpseudoβ.
- Returns:
The computed impedance (Z) matrix.
- Return type:
- __hash__()#
Hash method.