SMatrix

class photonforge.SMatrix(frequencies, elements, ports=None)

S matrix object.

Parameters:
  • frequencies – Frequency values for the computed elements.

  • elements – Mapping from pairs of port names and mode numbers to S matrix elements. The keys have the format: ("in_port@in_mode", "out_port@out_mode").

  • ports – Mapping from port names to ports or to None.

Example

>>> s_matrix = SMatrix(
...     [C_0 / 1.55],
...     {("P0@0", "P0@0"): [0], ("P0@0", "P1@0"): [1j]},
... )

Methods

copy()

Create a copy of this s_matrix.

load_snp(cls, filename[, ports])

Load an S matrix from a Touchstone (snp) file.

write_snp(filename)

Write this S matrix in a Touchstone (snp) file.

Attributes

elements

S matrix elements (read only).

frequencies

S matrix frequencies (read only).

ports

S matrix ports (read only).

wavelengths

S matrix wavelengths (read only).

copy()

Create a copy of this s_matrix.

Returns:

New copy.

elements

S matrix elements (read only).

frequencies

S matrix frequencies (read only).

static load_snp(cls, filename, ports=())

Load an S matrix from a Touchstone (snp) file.

Parameters:
  • filename – Touchstone file name to load.

  • ports – Sequence of port names to be associated with the ports in the Touchstone file. Each element in the sequence can also be a tuple with port name and number of supported modes in case of multimode ports. If no ports are provided, default ones are used.

Returns:

SMatrix.

See also

Data Model

ports

S matrix ports (read only).

wavelengths

S matrix wavelengths (read only).

write_snp(filename)

Write this S matrix in a Touchstone (snp) file.

Parameters:

filename – Touchstone file name to write.

Note

The order of the ports in the S matrix is sorted by name and mode number, e.g., “P0@0”, “P0@1”, “P1@0”, etc.

Returns:

This object.