tidy3d.plugins.mode.ModeSolverData#
- class ModeSolverData[source]#
Bases:
ModeSolverDataset
,ElectromagneticFieldData
Data associated with a
ModeSolverMonitor
: scalar components of E and H fields.- Parameters:
Ex (Attribute:
Ex
) –Type
ScalarModeFieldDataArray
Default
Description
Spatial distribution of the x-component of the electric field of the mode.
Ey (Attribute:
Ey
) –Type
ScalarModeFieldDataArray
Default
Description
Spatial distribution of the y-component of the electric field of the mode.
Ez (Attribute:
Ez
) –Type
ScalarModeFieldDataArray
Default
Description
Spatial distribution of the z-component of the electric field of the mode.
Hx (Attribute:
Hx
) –Type
ScalarModeFieldDataArray
Default
Description
Spatial distribution of the x-component of the magnetic field of the mode.
Hy (Attribute:
Hy
) –Type
ScalarModeFieldDataArray
Default
Description
Spatial distribution of the y-component of the magnetic field of the mode.
Hz (Attribute:
Hz
) –Type
ScalarModeFieldDataArray
Default
Description
Spatial distribution of the z-component of the magnetic field of the mode.
monitor (Attribute:
monitor
) –Type
ModeSolverMonitor
Default
Description
Mode solver monitor associated with the data.
symmetry (Attribute:
symmetry
) –Type
Tuple[Literal[0, -1, 1], Literal[0, -1, 1], Literal[0, -1, 1]]
Default
= (0, 0, 0)
Description
Symmetry eigenvalues of the original simulation in x, y, and z.
symmetry_center (Attribute:
symmetry_center
) –Type
Optional[Tuple[float, float, float]]
Default
= None
Description
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 (Attribute:
grid_expanded
) –Type
Optional[Grid]
Default
= None
Description
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 and flux.grid_primal_correction (Attribute:
grid_primal_correction
) –Type
Union[float, FreqDataArray, TimeDataArray, FreqModeDataArray]
Default
= 1.0
Description
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 (Attribute:
grid_dual_correction
) –Type
Union[float, FreqDataArray, TimeDataArray, FreqModeDataArray]
Default
= 1.0
Description
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_complex (Attribute:
n_complex
) –Type
ModeIndexDataArray
Default
Description
Complex-valued effective propagation constants associated with the mode.
n_group_raw (Attribute:
n_group_raw
) –Type
Optional[GroupIndexDataArray]
Default
= None
Description
Index associated with group velocity of the mode.
dispersion_raw (Attribute:
dispersion_raw
) –Type
Optional[ModeDispersionDataArray]
Default
= None
Units
ps/(nm km)
Description
Dispersion parameter for the mode.
eps_spec (Attribute:
eps_spec
) –Type
Optional[List[Literal[‘diagonal’, ‘tensorial_real’, ‘tensorial_complex’]]]
Default
= None
Description
Characterization of the permittivity profile on the plane where modes are computed. Possible values are ‘diagonal’, ‘tensorial_real’, ‘tensorial_complex’.
Notes
The data is stored as a DataArray object using the xarray package.
Example
>>> from tidy3d import ModeSpec >>> from tidy3d import ScalarModeFieldDataArray, ModeIndexDataArray >>> x = [-1,1,3] >>> y = [-2,0] >>> z = [-3,-1,1,3,5] >>> f = [2e14, 3e14] >>> mode_index = np.arange(5) >>> grid = Grid(boundaries=Coords(x=x, y=y, z=z)) >>> field_coords = dict(x=x[:-1], y=y[:-1], z=z[:-1], f=f, mode_index=mode_index) >>> field = ScalarModeFieldDataArray((1+1j)*np.random.random((2,1,4,2,5)), coords=field_coords) >>> index_coords = dict(f=f, mode_index=mode_index) >>> index_data = ModeIndexDataArray((1+1j) * np.random.random((2,5)), coords=index_coords) >>> monitor = ModeSolverMonitor( ... size=(2,0,6), ... freqs=[2e14, 3e14], ... mode_spec=ModeSpec(num_modes=5), ... name='mode_solver', ... ) >>> data = ModeSolverData( ... monitor=monitor, ... Ex=field, ... Ey=field, ... Ez=field, ... Hx=field, ... Hy=field, ... Hz=field, ... n_complex=index_data, ... grid_expanded=grid ... )
Attributes
Dataset collecting various properties of the stored modes.
Compute the TE and TM polarization fraction defined as the field intensity along the first or the second of the two tangential axes.
Compute the TE and TM polarization fraction using the waveguide definition.
Make a copy of the data with direction-reversed fields.
Methods
eps_spec_match_mode_spec
(val, values)Raise validation error if frequencies in eps_spec does not match frequency list
overlap_sort
(track_freq[, overlap_thresh])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.xarray-like method to export the
modes_info
into a pandas dataframe which is e.g.- monitor#
- eps_spec#
- classmethod eps_spec_match_mode_spec(val, values)[source]#
Raise validation error if frequencies in eps_spec does not match frequency list
- overlap_sort(track_freq, overlap_thresh=0.9)[source]#
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 givenmode_index
corresponds to physically the same mode at all frequencies. Modes with overlap values overoverlap_tresh
are considered matching and not rearranged.- Parameters:
track_freq (Literal["central", "lowest", "highest"]) – Parameter that specifies which frequency will serve as a starting point in the reordering process.
overlap_thresh (float = 0.9) – Modal overlap threshold above which two modes are considered to be the same and are not rearranged. If after the sorting procedure the overlap value between two corresponding modes is less than this threshold, a warning about a possible discontinuity is displayed.
- property time_reversed_copy#
Make a copy of the data with direction-reversed fields. In lossy or gyrotropic systems, the time-reversed fields will not be the same as the backward-propagating modes.
- property 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
E1
andE2
are the electric field components along the two tangential axes, the TE fraction is defined asintegrate(E1.abs**2) / integrate(E1.abs**2 + E2.abs**2)
, and theTM
fraction is equal to one minus the TE fraction. The tangential axes are defined by popping the normal axis from the list ofx, y, z
, so e.g.x
andz
for propagation in they
direction.
- property pol_fraction_waveguide#
Compute the TE and TM polarization fraction using the waveguide definition. If
E1
andE2
are the electric field components along the two tangential axes andEn
is the component along the propagation direction, the TE fraction is defined as1 - integrate(En.abs**2) / integrate(E1.abs**2 + E2.abs**2 + En.abs**2)
, and theTM
fraction is defined as1 - integrate(Hn.abs**2) / integrate(H1.abs**2 + H2.abs**2 + Hn.abs**2)
, withH
denoting the magnetic field components.Note
The waveguide TE and TM fractions do not sum to one. For example, TEM modes that are completely transverse (zero electric and magnetic field in the propagation direction) have TE fraction and TM fraction both equal to one.
- property modes_info#
Dataset collecting various properties of the stored modes.
- to_dataframe()[source]#
xarray-like method to export the
modes_info
into a pandas dataframe which is e.g. simple to visualize as a table.
- __hash__()#
Hash method.
- Ex#
- Ey#
- Ez#
- Hx#
- Hy#
- Hz#
- n_complex#
- n_group_raw#
- dispersion_raw#
- grid_primal_correction#
- grid_dual_correction#
- symmetry#
- symmetry_center#
- grid_expanded#