tidy3d.ModeSimulationData#

class ModeSimulationData[source]#

Bases: AbstractYeeGridSimulationData

Data associated with a mode solver simulation.

Parameters:

Attributes

modes

ModeSolverData containing the field and effective index data.

simulation

modes_raw

data

log

Methods

plot_field(field_name[, val, scale, ...])

Plot the field for a ModeSolverData with Simulation plot overlaid.

sort_modes(sort_spec)

Sort modes per frequency according to sort_spec.

simulation#
modes_raw#
data#
property modes#

ModeSolverData containing the field and effective index data.

plot_field(field_name, val='real', scale='lin', eps_alpha=0.2, robust=True, vmin=None, vmax=None, ax=None, cmap=None, **sel_kwargs)[source]#

Plot the field for a ModeSolverData with Simulation plot overlaid.

Parameters:
  • field_name (str) – Name of field component to plot (eg. 'Ex'). Also accepts 'E' and 'H' to plot the vector magnitudes of the electric and magnetic fields, and 'S' for the Poynting vector.

  • val (Literal['real', 'imag', 'abs', 'abs^2', 'dB'] = 'real') – Which part of the field to plot.

  • eps_alpha (float = 0.2) – Opacity of the structure permittivity. Must be between 0 and 1 (inclusive).

  • robust (bool = True) – If True and vmin or vmax are absent, uses the 2nd and 98th percentiles of the data to compute the color limits. This helps in visualizing the field patterns especially in the presence of a source.

  • vmin (float = None) – The lower bound of data range that the colormap covers. If None, they are inferred from the data and other keyword arguments.

  • vmax (float = None) – The upper bound of data range that the colormap covers. If None, they are inferred from the data and other keyword arguments.

  • ax (matplotlib.axes._subplots.Axes = None) – matplotlib axes to plot on, if not specified, one is created.

  • cmap (Optional[Union[str, Colormap]] = None) – Colormap for visualizing the field values. None uses the default which infers it from the data.

  • sel_kwargs (keyword arguments used to perform .sel() selection in the monitor data.) – These kwargs can select over the spatial dimensions (x, y, z), frequency or time dimensions (f, t) or mode_index, if applicable. For the plotting to work appropriately, the resulting data after selection must contain only two coordinates with len > 1. Furthermore, these should be spatial coordinates (x, y, or z).

Returns:

The supplied or created matplotlib axes.

Return type:

matplotlib.axes._subplots.Axes

sort_modes(sort_spec)[source]#

Sort modes per frequency according to sort_spec.