tidy3d.EMESimulationData#

class EMESimulationData[source]#

Bases: AbstractYeeGridSimulationData

Data associated with an EME simulation.

Parameters:

Notes

Contains the results of an EMESimulation, including the scattering matrix (smatrix), port modes (port_modes), mode coefficients (coeffs), and any monitor data recorded during the simulation.

The scattering matrix is expressed in the basis of the port modes. Use smatrix_in_basis() to re-express it in a different modal basis, for example to compute transmission into a specific mode of an output waveguide. Similarly, use field_in_basis() to re-express the propagated field.

Accessing Results

Fundamental-mode transmission and reflection:

T = sim_data.smatrix.S21.isel(mode_index_in=0, mode_index_out=0).abs ** 2
R = sim_data.smatrix.S11.isel(mode_index_in=0, mode_index_out=0).abs ** 2

Monitor data recorded by an EMEFieldMonitor or EMECoefficientMonitor can be accessed by name:

field_data = sim_data["field_monitor_name"]

To express the scattering matrix in a custom modal basis (e.g., modes of individual output waveguides), add an EMEModeSolverMonitor at the output port and use smatrix_in_basis():

smatrix_custom = sim_data.smatrix_in_basis(modes2=sim_data["output_monitor"])

See also

EMESimulation

The simulation object that produces this data.

EMESMatrixDataset

The scattering matrix dataset.

Example

>>> import tidy3d as td
>>> sim = td.EMESimulation(
...     size=(2, 2, 6),
...     freqs=[2e14],
...     axis=2,
...     eme_grid_spec=td.EMEUniformGrid(
...         num_cells=3, mode_spec=td.EMEModeSpec(num_modes=2)
...     ),
...     grid_spec=td.GridSpec.auto(wavelength=1.55),
... )
>>> sim_data = EMESimulationData(simulation=sim, data=())

Attributes

port_modes

Modes associated with the two ports of the EME device.

port_modes_list_sweep

Port modes as a list of tuples, one per sweep index.

port_modes_tuple

Port modes as a tuple (port_modes_1, port_modes_2).

simulation

data

smatrix

coeffs

port_modes_raw

log

Methods

field_in_basis(field[, modes, port_index])

Express the electromagnetic field in the provided basis.

smatrix_in_basis([modes1, modes2])

Express the scattering matrix in the provided basis.

simulation#
data#
smatrix#
coeffs#
port_modes_raw#
property port_modes#

Modes associated with the two ports of the EME device. The scattering matrix is expressed in this basis. Note: these modes are symmetry expanded.

property port_modes_tuple#

Port modes as a tuple (port_modes_1, port_modes_2).

Returns:

A pair of ModeSolverData for port 1 and port 2, respectively. Raises SetupError if store_port_modes was not enabled, or if port modes vary with sweep index (use port_modes_list_sweep instead).

Return type:

tuple[ModeSolverData, ModeSolverData]

property port_modes_list_sweep#

Port modes as a list of tuples, one per sweep index.

Returns:

A list with one (port_modes_1, port_modes_2) tuple per sweep index. If the sweep does not change the modes (e.g. EMELengthSweep), the list contains a single entry.

Return type:

list[tuple[ModeSolverData, ModeSolverData]]

smatrix_in_basis(modes1=None, modes2=None)[source]#

Express the scattering matrix in the provided basis. Change of basis is done by computing overlaps between provided modes and port modes.

Parameters:
  • modes1 (Union[FieldData, ModeData]) – New modal basis for port 1. If None, use port_modes.

  • modes2 (Union[FieldData, ModeData]) – New modal basis for port 2. If None, use port_modes.

Returns:

The scattering matrix of the EME simulation, but expressed in the basis of the provided modes, rather than in the basis of port_modes used in computation.

Return type:

EMESMatrixDataset

Notes

This is useful when the computational port modes do not match the modes of interest. For example, in a waveguide splitter the output port spans multiple waveguides, so the EME port modes are super-modes of the combined structure. To obtain the scattering matrix in the basis of individual waveguide modes, place an EMEModeSolverMonitor over each output waveguide and pass the resulting data here.

store_port_modes must be True in the EMESimulation for this method to work.

Typical workflow:

# 1. Add a monitor over the output waveguide(s)
output_mon = td.EMEModeSolverMonitor(
    size=output_size, center=output_center, name="output", ...
)

# 2. After running, re-express the S-matrix
smatrix_custom = sim_data.smatrix_in_basis(modes2=sim_data["output"])
T_custom = smatrix_custom.S21.isel(mode_index_in=0, mode_index_out=0).abs ** 2
field_in_basis(field, modes=None, port_index=0)[source]#

Express the electromagnetic field in the provided basis. Change of basis is done by computing overlaps between provided modes and port modes.

Parameters:
  • field (EMEFieldData) – EME field to express in new basis.

  • modes (Union[FieldData, ModeData]) – New modal basis. If None, use port_modes.

  • port_index (Literal[0, 1]) – Port to excite.

Returns:

The propagated electromagnetic field expressed in the basis of the provided modes, rather than in the basis of port_modes used in computation.

Return type:

EMEFieldData