Panel#

class lumopt2.utils.panels.Panel(title: str | None = None)#

Abstract base class for a single subplot in a GraphicalVisualizer.

Subclasses implement setup to create their persistent matplotlib artists and update to refresh those artists on every iteration. The default on_optimization_end is a no-op; override it for any end-of-run flourishes (e.g. drawing a “converged” marker).

Attributes:
titlestr, optional

Title for the panel’s subplot. Subclasses pick a sensible default when None (default: None).

requires_forward_resultsbool

Class-level flag. When True, GraphicalVisualizer ensures the project’s FDTD session has the latest forward simulation file loaded before calling update(). Override in subclasses that read monitor data from the live FDTD session (e.g. MonitorPanel). Defaults to False so panels whose data comes purely from PanelState (FOM trace, gradient norm, geometry) avoid the disk reload cost.

Methods

Panel.on_optimization_end(ax, fig, project, ...)

Optional hook called once when the optimization completes.

Panel.setup(ax, fig, project)

Initialise the panel on its assigned axes.

Panel.update(ax, fig, project, state)

Refresh the panel from a PanelState snapshot.

Attributes