FomPanel#

class lumopt2.utils.panels.FomPanel(title: str | None = 'Optimization Progress', show_best: bool = True, log_y: bool = False, color: str = 'C0', marker: str = 'o', linewidth: float = 2.0, markersize: float = 4.0, label: str = 'FOM')#

Live plot of the figure of merit vs. iteration.

A single matplotlib.lines.Line2D and an annotation matplotlib.text.Text are created in setup() and mutated in place by update(), so the panel stays inexpensive to redraw even for long runs.

Attributes:
titlestr, optional

Panel title (default: 'Optimization Progress').

show_bestbool, optional

If True, annotate the best (maximum) FOM value seen so far in the upper-left corner of the panel (default: True).

log_ybool, optional

If True, render the FOM trace on a logarithmic y-axis. Useful when the FOM spans many decades. Note that non-positive values are clipped by matplotlib in log mode (default: False).

colorstr, optional

Matplotlib color spec for the trace (default: 'C0').

markerstr, optional

Matplotlib marker for the trace (default: 'o').

linewidthfloat, optional

Line width for the trace (default: 2.0).

markersizefloat, optional

Marker size for the trace (default: 4.0).

labelstr, optional

Legend label for the trace (default: 'FOM').

Methods

FomPanel.on_optimization_end(ax, fig, ...)

Optional hook called once when the optimization completes.

FomPanel.setup(ax, fig, project)

Create the persistent line + best-text artists on ax.

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

Push the latest FOM history into the persistent artists.

Attributes