tidy3d.EMESimulationData#
- class EMESimulationData[source]#
Bases:
AbstractYeeGridSimulationDataData associated with an EME simulation.
- Parameters:
simulation (
EMESimulation) – EME simulation associated with this data.data (tuple[Union[
EMEModeSolverData,EMEFieldData,EMECoefficientData,ModeSolverData,PermittivityData,MediumData], …]) – List of EME monitor data associated with the monitors of the originalEMESimulation.log (Optional[str] = None) – A string containing the log information from the simulation run.
smatrix (Optional[
EMESMatrixDataset] = None) – Scattering matrix of the EME simulation.coeffs (Optional[Union[
EMECoefficientData,EMECoefficientDataset]] = None) – Coefficients from the EME simulation. Useful for debugging and optimization.port_modes_raw (Optional[
EMEModeSolverData] = None) – Modes associated with the two ports of the EME device. The scattering matrix is expressed in this basis. Note: these modes are not symmetry expanded; use ‘port_modes’ instead.
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, usefield_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
EMEFieldMonitororEMECoefficientMonitorcan 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
EMEModeSolverMonitorat the output port and usesmatrix_in_basis():smatrix_custom = sim_data.smatrix_in_basis(modes2=sim_data["output_monitor"])
See also
EMESimulationThe simulation object that produces this data.
EMESMatrixDatasetThe 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
Modes associated with the two ports of the EME device.
Port modes as a list of tuples, one per sweep index.
Port modes as a tuple
(port_modes_1, port_modes_2).logMethods
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
ModeSolverDatafor port 1 and port 2, respectively. RaisesSetupErrorifstore_port_modeswas not enabled, or if port modes vary with sweep index (useport_modes_list_sweepinstead).- 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:
- Returns:
The scattering matrix of the EME simulation, but expressed in the basis of the provided modes, rather than in the basis of
port_modesused in computation.- Return type:
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
EMEModeSolverMonitorover each output waveguide and pass the resulting data here.store_port_modesmust beTruein theEMESimulationfor 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_modesused in computation.- Return type: