tidy3d.ModeData#

class ModeData[source]#

Bases: MonitorData

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

Parameters:
  • monitor (Attribute: monitor) –

    Type

    ModeMonitor

    Default

    Description

    Mode monitor associated with the data.

  • amps (Attribute: amps) –

    Type

    ModeAmpsDataArray

    Default

    Description

    Complex-valued amplitudes associated with the mode.

  • 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.

Notes

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 :attr`n_complex` contains two coordinates: f and mode_index, both of which are specified when defining the :class:ModeMonitor in the simulation.

Besides the effective index, :class: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.

Example

>>> 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)

Attributes

dispersion

Dispersion parameter.

k_eff

Imaginary part of the propagation index.

n_eff

Real part of the propagation index.

n_group

Group index.

Methods

normalize(source_spectrum_fn)

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

monitor#
amps#
n_complex#
n_group_raw#
dispersion_raw#
property n_eff#

Real part of the propagation index.

property k_eff#

Imaginary part of the propagation index.

property n_group#

Group index.

property dispersion#

Dispersion parameter.

\[D = -\frac{\lambda}{c_0} \frac{{\rm d}^2 n_{\text{eff}}}{{\rm d}\lambda^2}\]
normalize(source_spectrum_fn)[source]#

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

__hash__()#

Hash method.