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 usesproject.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 missingvisualizemethod is reported once at startup with a clear error rather than per-iteration tracebacks.- Attributes:
- parametrization
object,optional Parametrization to render. When
None(default), usesproject.parametrizationresolved atsetup()time.- title
str,optional Panel title (default:
'Geometry Evolution').- aspect
str,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').- xlabel
str,optional Label for the x-axis (default:
'x (m)').- ylabel
str,optional Label for the y-axis (default:
'y (m)').
- parametrization
- Raises:
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