maxwelllink.tools.plotting module¶
Publication-ready plotting helpers shared across MaxwellLink.
- maxwelllink.tools.plotting.draw_molecules(cavity, ax, vertical=None)[source]¶
Shade the MaxwellLink molecules placed in the cavity: those of the molecule-level route (
placed_molecules, fromplace_molecule) and the molecular media of the grid-level route (placed_regions, fromplace_region).- Parameters:
cavity (DummyCavity subclass) – The cavity whose
placed_molecules/placed_regionsare drawn.ax (matplotlib Axes) – The axes to draw into.
vertical (str or None, optional) – None for the 1D profile view (x-spans in nm); the vertical axis label (“y” or “z”) for a plan view (rectangles in Meep units).
- maxwelllink.tools.plotting.draw_optical_planes(cavity, ax, in_nm=True, setup=None)[source]¶
Draw the excitation and detectors of a cavity measurement setup.
The drawing is structural: a zero-size excitation is a point source (star), a finite one a plane or sheet (line/segment); a detector that is a
{"center", "size"}dict is a plane (line), and one that is a list ofmp.FluxRegionfaces is outlined face by face.- Parameters:
cavity (DummyCavity subclass) – The cavity whose setup is drawn.
ax (matplotlib Axes) – The axes to draw into.
in_nm (bool, default: True) – Whether the x-axis of
axis in nm (the 1D profile view) or in Meep units (theplot2Dplan view).setup (dict or None, optional) – A pre-fetched setup dict (e.g.
cavity.emission_setup()). Default:cavity.optical_setup().
- maxwelllink.tools.plotting.plot_cavity(cavity, ax=None, setup='optical', **kwargs)[source]¶
Visualize a cavity in MEEP cavity module (src/maxwelllink/cavity/).
- Parameters:
cavity (DummyCavity subclass) – The cavity to draw.
ax (matplotlib Axes or None, optional) – Axes to draw into. A new figure is created when None.
setup (str, default: "optical") – Which measurement setup to draw: the far-field probe (“optical”) or the local-dipole one (“emission”).
**kwargs – Forwarded to
mp.Simulation.plot2Din the plan view.
- Returns:
The axes containing the plot.
- Return type:
matplotlib Axes
- maxwelllink.tools.plotting.plot_cavity_1d(cavity, ax=None, setup='optical')[source]¶
Draw the 1D view of a cavity with a refractive-index profile n(x)
- Parameters:
cavity (DummyCavity subclass) – The cavity to draw (its x-axis, in nm).
ax (matplotlib Axes or None, optional) – Axes to draw into. A new figure is created when None.
setup (str, default: "optical") – Which measurement setup to draw: the far-field probe (“optical”) or the local-dipole one (“emission”).
- Returns:
The axes containing the plot.
- Return type:
matplotlib Axes
- maxwelllink.tools.plotting.plot_cavity_2d(cavity, ax=None, setup='optical', **kwargs)[source]¶
Draw the plan view of a cavity via
mp.Simulation.plot2D(2D, 3D, and cylindrical cells). In 3D the default view is the x-z plane through the cell center (override withoutput_plane=).- Parameters:
cavity (DummyCavity subclass) – The cavity to draw.
ax (matplotlib Axes or None, optional) – Axes to draw into. A new figure is created when None.
setup (str, default: "optical") – Which measurement setup to draw: the far-field probe (“optical”) or the local-dipole one (“emission”).
**kwargs – Forwarded to
mp.Simulation.plot2D.
- Returns:
The axes containing the plot.
- Return type:
matplotlib Axes
- maxwelllink.tools.plotting.polish_axes(ax, xlabel=None, ylabel=None, despine=False)[source]¶
Apply the publication finishing touches to an axes.
- Parameters:
ax (matplotlib Axes) – The axes to polish.
xlabel (str or None, optional) – Axis labels to set (existing labels are kept when None).
ylabel (str or None, optional) – Axis labels to set (existing labels are kept when None).
despine (bool, default: True) – Whether to remove the top and right spines.