tidy3d.ModeSolverData#
- class ModeSolverData[source]#
Bases:
ModeSolverDataset,ElectromagneticFieldDataData associated with a
ModeSolverMonitor: scalar components of E and H fields.- Parameters:
Ex (Attribute:
Ex) –TypeScalarModeFieldDataArray
DefaultDescriptionSpatial distribution of the x-component of the electric field of the mode.
Ey (Attribute:
Ey) –TypeScalarModeFieldDataArray
DefaultDescriptionSpatial distribution of the y-component of the electric field of the mode.
Ez (Attribute:
Ez) –TypeScalarModeFieldDataArray
DefaultDescriptionSpatial distribution of the z-component of the electric field of the mode.
Hx (Attribute:
Hx) –TypeScalarModeFieldDataArray
DefaultDescriptionSpatial distribution of the x-component of the magnetic field of the mode.
Hy (Attribute:
Hy) –TypeScalarModeFieldDataArray
DefaultDescriptionSpatial distribution of the y-component of the magnetic field of the mode.
Hz (Attribute:
Hz) –TypeScalarModeFieldDataArray
DefaultDescriptionSpatial distribution of the z-component of the magnetic field of the mode.
monitor (Attribute:
monitor) –TypeModeSolverMonitor
DefaultDescriptionMode solver monitor associated with the data.
symmetry (Attribute:
symmetry) –TypeTuple[Literal[0, -1, 1], Literal[0, -1, 1], Literal[0, -1, 1]]
Default= (0, 0, 0)
DescriptionSymmetry eigenvalues of the original simulation in x, y, and z.
symmetry_center (Attribute:
symmetry_center) –TypeOptional[Tuple[float, float, float]]
Default= None
DescriptionCenter of the symmetry planes of the original simulation in x, y, and z. Required only if any of the
symmetryfield are non-zero.grid_expanded (Attribute:
grid_expanded) –TypeOptional[Grid]
Default= None
DescriptionGriddiscretization 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) –TypeUnion[float, FreqDataArray, TimeDataArray, FreqModeDataArray]
Default= 1.0
DescriptionCorrection 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) –TypeUnion[float, FreqDataArray, TimeDataArray, FreqModeDataArray]
Default= 1.0
DescriptionCorrection 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) –TypeModeIndexDataArray
DefaultDescriptionComplex-valued effective propagation constants associated with the mode.
n_group_raw (Attribute:
n_group_raw) –TypeOptional[GroupIndexDataArray]
Default= None
DescriptionIndex associated with group velocity of the mode.
dispersion_raw (Attribute:
dispersion_raw) –TypeOptional[ModeDispersionDataArray]
Default= None
Unitsps/(nm km)
DescriptionDispersion parameter for the mode.
eps_spec (Attribute:
eps_spec) –TypeOptional[List[Literal[‘diagonal’, ‘tensorial_real’, ‘tensorial_complex’]]]
Default= None
DescriptionCharacterization 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_infointo 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_indexcorresponds to physically the same mode at all frequencies. Modes with overlap values overoverlap_treshare 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
E1andE2are 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 theTMfraction 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.xandzfor propagation in theydirection.
- property pol_fraction_waveguide#
Compute the TE and TM polarization fraction using the waveguide definition. If
E1andE2are the electric field components along the two tangential axes andEnis 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 theTMfraction is defined as1 - integrate(Hn.abs**2) / integrate(H1.abs**2 + H2.abs**2 + Hn.abs**2), withHdenoting 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_infointo a pandas dataframe which is e.g. simple to visualize as a table.
- __hash__()#
Hash method.