GeometryPanel#

class lumopt2.utils.panels.GeometryPanel(title: str | None = 'Geometry Evolution', parametrization: Any | None = None, aspect: str = 'equal', xlabel: str = 'x (m)', ylabel: str = 'y (m)')#

Live plot of the current geometry on top of the initial baseline.

Defers all drawing to parametrization.visualize(ax, params, initial_params). By default uses project.parametrization (the one being optimized), but an explicit override lets you display a secondary parametrization (e.g. a coarse preview during topology runs).

The chosen parametrization is validated in setup() so a missing visualize method is reported once at startup with a clear error rather than per-iteration tracebacks.

Attributes:
parametrizationobject, optional

Parametrization to render. When None (default), uses project.parametrization resolved at setup() time.

titlestr, optional

Panel title (default: 'Geometry Evolution').

aspectstr, optional

Matplotlib axes aspect for the plot. 'equal' keeps x and y at the same scale, which is almost always what you want for spatial geometries (default: 'equal').

xlabelstr, optional

Label for the x-axis (default: 'x (m)').

ylabelstr, optional

Label for the y-axis (default: 'y (m)').

Raises:
TypeError

Raised by setup() when neither the explicit parametrization nor project.parametrization exposes a callable visualize(ax, params, initial_params).

Methods

GeometryPanel.on_optimization_end(ax, fig, ...)

Optional hook called once when the optimization completes.

GeometryPanel.setup(ax, fig, project)

Resolve the parametrization, validate it, and configure the axes.

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

Re-render the geometry by delegating to parametrization.visualize.

Attributes