tidy3d.ModeSolverData#

class ModeSolverData[source]#

Bases: ModeData

Data associated with a ModeSolverMonitor: scalar components of E and H fields.

Parameters:
  • attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, attrs are mutable. For example, the following is allowed for setting an attr obj.attrs['foo'] = bar. Also note that Tidy3D` will raise a TypeError if attrs contain objects that can not be serialized. One can check if attrs are serializable by calling obj.json().

  • Ex (Optional[ScalarModeFieldDataArray] = None) – Spatial distribution of the x-component of the electric field of the mode.

  • Ey (Optional[ScalarModeFieldDataArray] = None) – Spatial distribution of the y-component of the electric field of the mode.

  • Ez (Optional[ScalarModeFieldDataArray] = None) – Spatial distribution of the z-component of the electric field of the mode.

  • Hx (Optional[ScalarModeFieldDataArray] = None) – Spatial distribution of the x-component of the magnetic field of the mode.

  • Hy (Optional[ScalarModeFieldDataArray] = None) – Spatial distribution of the y-component of the magnetic field of the mode.

  • Hz (Optional[ScalarModeFieldDataArray] = None) – Spatial distribution of the z-component of the magnetic field of the mode.

  • monitor (ModeSolverMonitor) – Mode solver monitor associated with the data.

  • symmetry (Tuple[Literal[0, -1, 1], Literal[0, -1, 1], Literal[0, -1, 1]] = (0, 0, 0)) – Symmetry eigenvalues of the original simulation in x, y, and z.

  • symmetry_center (Optional[Tuple[float, float, float]] = 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 (Optional[Grid] = 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 (Union[float, FreqDataArray, TimeDataArray, FreqModeDataArray, EMEFreqModeDataArray] = 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 (Union[float, FreqDataArray, TimeDataArray, FreqModeDataArray, EMEFreqModeDataArray] = 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_complex (ModeIndexDataArray) – Complex-valued effective propagation constants associated with the mode.

  • n_group_raw (Optional[GroupIndexDataArray] = None) – Index associated with group velocity of the mode.

  • dispersion_raw (Optional[ModeDispersionDataArray] = None) – [units = ps/(nm km)]. Dispersion parameter for the mode.

  • amps (Optional[ModeAmpsDataArray] = None) – Unused for ModeSolverData.

  • eps_spec (Optional[List[Literal['diagonal', 'tensorial_real', 'tensorial_complex']]] = None) – 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

time_reversed_copy

Make a copy of the data with direction-reversed fields.

attrs

Methods

normalize(source_spectrum_fn)

Return copy of self after normalization is applied using source spectrum function.

Inherited Common Usage

monitor#
amps#
normalize(source_spectrum_fn)[source]#

Return copy of self after normalization is applied using source spectrum function.

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.

__hash__()#

Hash method.