Skip to content

flex_rf.tidy3d.ModeData

Type: class Base(s): ModeSolverDataset, AbstractOverlapData

Data associated with a ModeMonitor: modal amplitudes, propagation indices and mode profiles.

The data is stored as a DataArray object using the xarray package.

The mode monitor data contains the complex effective indices and the complex mode amplitudes at the monitor position calculated by mode decomposition. The data structure of the complex effective indices :attrn_complex contains two coordinates: f and mode_index, both of which are specified when defining the ModeMonitor in the simulation.

Besides the effective index, ModeMonitor is primarily used to calculate the transmission of certain modes in certain directions. We can extract the complex amplitude and square it to compute the mode transmission power.

from tidy3d import ModeSpec
from tidy3d import ModeAmpsDataArray, ModeIndexDataArray
direction = ["+", "-"]
f = [1e14, 2e14, 3e14]
mode_index = np.arange(5)
index_coords = dict(f=f, mode_index=mode_index)
index_data = ModeIndexDataArray((1+1j) * np.random.random((3, 5)), coords=index_coords)
amp_coords = dict(direction=direction, f=f, mode_index=mode_index)
amp_data = ModeAmpsDataArray((1+1j) * np.random.random((2, 3, 5)), coords=amp_coords)
monitor = ModeMonitor(
size=(2,0,6),
freqs=[2e14, 3e14],
mode_spec=ModeSpec(num_modes=5),
name='mode',
)
data = ModeData(monitor=monitor, amps=amp_data, n_complex=index_data)
amps [ModeAmpsDataArray]

Complex-valued amplitudes of the overlap decomposition.

n_complex [ModeIndexDataArray]

Complex-valued effective propagation constants associated with the mode.

monitor [ModeMonitor]

Monitor associated with the data.

Ex [ScalarModeFieldDataArray | None] = None

Spatial distribution of the x-component of the electric field of the mode.

Ey [ScalarModeFieldDataArray | None] = None

Spatial distribution of the y-component of the electric field of the mode.

Ez [ScalarModeFieldDataArray | None] = None

Spatial distribution of the z-component of the electric field of the mode.

Hx [ScalarModeFieldDataArray | None] = None

Spatial distribution of the x-component of the magnetic field of the mode.

Hy [ScalarModeFieldDataArray | None] = None

Spatial distribution of the y-component of the magnetic field of the mode.

Hz [ScalarModeFieldDataArray | None] = None

Spatial distribution of the z-component of the magnetic field of the mode.

symmetry [tuple[Symmetry, Symmetry, Symmetry]] = (0, 0, 0)

Symmetry eigenvalues of the original simulation in x, y, and z.

symmetry_center [Coordinate | None] = None

Center of the symmetry planes of the original simulation in x, y, and z. Required only if any of the symmetry field are non-zero.

grid_expanded [Grid | None] = None

Grid discretization of the associated monitor in the simulation which created the data. Required if symmetries are present, as well as in order to use some functionalities like getting Poynting vector and flux.

grid_primal_correction [GRID_CORRECTION_TYPE] = 1.0

Correction factor that needs to be applied for data corresponding to a 2D monitor to take into account the finite grid in the normal direction in the simulation in which the data was computed. The factor is applied to fields defined on the primal grid locations along the normal direction.

grid_dual_correction [GRID_CORRECTION_TYPE] = 1.0

Correction factor that needs to be applied for data corresponding to a 2D monitor to take into account the finite grid in the normal direction in the simulation in which the data was computed. The factor is applied to fields defined on the dual grid locations along the normal direction.

n_group_raw [GroupIndexDataArray | None] = None

Index associated with group velocity of the mode.

dispersion_raw [ModeDispersionDataArray | None] = None

Dispersion parameter for the mode.

eps_spec [list[EpsSpecType] | None] = None

Characterization of the permittivity profile on the plane where modes are computed. Possible values are ‘diagonal’, ‘tensorial_real’, ‘tensorial_complex’.

modes_info [xr.Dataset]

Dataset collecting various properties of the stored modes.

solver_field_bounds [BoundOptional]

Per-axis bounds where solver field data is physically valid.

TE_fraction [xr.DataArray]

Alias for pol_fraction.te.

TM_fraction [xr.DataArray]

Alias for pol_fraction.tm.

wg_TE_fraction [xr.DataArray]

Alias for pol_fraction_waveguide.te.

wg_TM_fraction [xr.DataArray]

Alias for pol_fraction_waveguide.tm.

eps_spec_match_mode_spec()

Raise validation error if frequencies in eps_spec does not match frequency list

overlap_sort(track_freq: TrackFreq, overlap_thresh: float = 0.9)

Starting from the base frequency defined by parameter track_freq, sort modes at each frequency according to their overlap values with the modes at the previous frequency. That is, it attempts to rearrange modes in such a way that a given mode_index corresponds to physically the same mode at all frequencies. Modes with overlap values over overlap_thresh are considered matching and not rearranged.

pol_fraction()

Compute the TE and TM polarization fraction defined as the field intensity along the first or the second of the two tangential axes. More precisely, if E1E_1 and E2E_2 are the electric field components along the two tangential axes, the TE fraction is defined as:

pol_fraction_waveguide()

Compute the TE and TM polarization fraction using the waveguide definition. If nn is the propagation direction, the TE fraction is defined as:

sort_modes(sort_spec: ModeSortSpec | None = None, track_freq: TrackFreq | None = None)

Sort modes per frequency according to sort_spec.

to_dataframe()

xarray-like method to export the modes_info into a pandas dataframe which is e.g. simple to visualize as a table.