legume.viz.field

legume.viz.field(struct, field, kind, mind, x=None, y=None, z=None, periodic=True, component='xyz', val='re', N1=100, N2=100, cbar=True, eps=True, eps_levels=None)

Visualize mode fields over a 2D slice in x, y, or z

Note

The fields must be solved for and stored in the GuidedModeExp or PlaneWaveExp object prior to calling this function.

Parameters:
  • struct (GuidedModeExp or PlaneWaveExp) –
  • field ({'H', 'D', 'E'}) – The field quantity to plot
  • kind (int) – The wave vector index to plot
  • mind (int) – The mode index to plot
  • y, z (x,) – Coordinate of the slice in either x, y, or z. One and only one of these should be specified
  • periodic (bool, optional) – Whether the periodic portion or the full field should be plotted
  • component (str, optional) – Component of the vector field to plot
  • val ({'re', 'im', 'abs'}, optional) – Field value to plot
  • N1 (int, optional) – Number of grid points to sample in first spatial dim
  • N2 (int, optional) – Number of grid points to sample in second spatial dim
  • cbar (bool, optional) – Whether to include a colorbar
  • eps (bool, optional) – Whether an outline of the permittivity should be overlaid
  • eps_levels (List, optional) – A list of contour levels for the permittivity
Returns:

fig – Figure object for the plot.

Return type:

matplotlib figure object