ZMatrix

class photonforge.ZMatrix(frequencies, elements, terminals=None)

Nodal impedance matrix (Z matrix).

Represents a frequency-dependent nodal impedance matrix where terminals correspond to circuit nodes. Can be returned from LumpedModel.start_mna(); when a port_map is specified, LumpedModel will 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 Z matrix elements. The keys must be: ("terminal1", "terminal2").

  • terminals (dict[str, Terminal | None] | None) – Mapping from terminal names to terminals or to None.

Example

>>> z_matrix = pf.ZMatrix(
...     [pf.C_0 / 1.55],
...     {("T0", "T0"): [50], ("T0", "T1"): [25]},
... )

Methods

copy()

Create a copy.

force_symmetric()

Force this Z matrix to be symmetric.

to_y_matrix()

Convert this Z matrix to a Y matrix by inversion.

Attributes

elements

Z matrix elements (read only).

frequencies

Z matrix frequencies (read only).

properties

Object properties.

terminals

Z matrix terminals (read only).

wavelengths

Z matrix wavelengths (read only).

copy()

Create a copy.

Returns:

New copy.

Return type:

ZMatrix

elements

Z matrix elements (read only).

Type:

dict[tuple[str, str], ndarray]

force_symmetric()

Force this Z 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:

ZMatrix

frequencies

Z matrix frequencies (read only).

Type:

ndarray

properties

Object properties.

Type:

Properties

terminals

Z matrix terminals (read only).

Type:

dict[str, Terminal | None]

to_y_matrix()

Convert this Z matrix to a Y matrix by inversion.

Returns:

The corresponding admittance matrix.

Return type:

YMatrix

Raises:

RuntimeError – If the Z matrix is singular at any frequency.

wavelengths

Z matrix wavelengths (read only).

Type:

ndarray