YMatrix¶
- class photonforge.YMatrix(frequencies, elements, terminals=None)¶
Nodal admittance matrix (Y matrix).
Represents a frequency-dependent nodal admittance matrix where terminals correspond to circuit nodes. Can be returned from
LumpedModel.start_mna(); when aport_mapis specified,LumpedModelwill extract port parameters and convert to S-matrix.- Parameters:
frequencies (Sequence[float]) – Frequency values for the computed elements.
elements (dict[tuple[str, str], Sequence[complex]]) – Mapping from pairs of terminal names to Y matrix elements. The keys must be:
("terminal1", "terminal2").terminals (dict[str, Terminal | None] | None) – Mapping from terminal names to terminals or to
None.
Example
>>> import numpy as np >>> frequencies = [1e9, 2e9, 5e9] >>> R, C = 100.0, 1e-12 >>> omega = 2 * np.pi * np.array(frequencies) >>> Y_R = np.full(len(frequencies), 1 / R, dtype=complex) >>> Y_C = 1j * omega * C >>> y_matrix = pf.YMatrix(frequencies, { ... ("in", "in"): Y_R, ... ("in", "out"): -Y_R, ... ("out", "in"): -Y_R, ... ("out", "out"): Y_R + Y_C, ... })
Methods
copy()Create a copy.
Force this Y matrix to be symmetric.
Convert this Y matrix to a Z matrix by inversion.
Attributes
Y matrix elements (read only).
Y matrix frequencies (read only).
Object properties.
Y matrix terminals (read only).
Y matrix wavelengths (read only).
- elements¶
Y matrix elements (read only).
- Type:
dict[tuple[str, str], ndarray]
- force_symmetric()¶
Force this Y matrix to be symmetric.
Reciprocity is ensured by averaging transposed entries (if both are present) or filling in missing elements.
- Returns:
This object.
- Return type:
- frequencies¶
Y matrix frequencies (read only).
- Type:
ndarray
- properties¶
Object properties.
- Type:
- to_z_matrix()¶
Convert this Y matrix to a Z matrix by inversion.
Z = Y^(-1)
- Returns:
The inverted impedance matrix.
- Return type:
- Raises:
RuntimeError – If the Y matrix is singular at any frequency.
- wavelengths¶
Y matrix wavelengths (read only).
- Type:
ndarray