Plotters¤
Vectorized drawings of force density datastructures for figures and papers. The 2D plotter is built on the standalone compas_plotter. A second plotter, built with matplotlib, charts the loss histories recorded during optimization.
Note
The plotter needs the standalone compas_plotter for use. Without it, the plotter degrades to a null object that warns on use.
Plotter
¤
A thin wrapper on the compas_plotter.plotter.Plotter.
This object exists for API consistency.
LossPlotter
¤
Chart a loss and its component errors over an optimization history.
Parameters:
-
loss(Loss) –The loss function whose terms are re-evaluated and plotted.
-
datastructure(FDNetwork | FDMesh) –The network or mesh the history parameters belong to.
-
kwargs(Any, default:{}) –Extra keyword arguments forwarded to the matplotlib figure.
plot
¤
plot(history: EquilibriumParametersState | list[Any], report_breakdown: bool = True, error_names: Iterable[str] | None = None, plot_legend: bool = True, yscale: str = 'log', **eq_kwargs: Any) -> Float[Array, iterations]
Plot the loss and its component errors over a parameter history.
Parameters:
-
history(EquilibriumParametersState | list[Any]) –The per-iteration parameter states to replay through the loss.
-
report_breakdown(bool, default:True) –If True, plot each error and regularization term separately and print its statistics.
-
error_names(Iterable[str] | None, default:None) –The subset of term names to break down. If None, every term is shown.
-
plot_legend(bool, default:True) –Whether to draw the plot legend.
-
yscale(str, default:'log') –The matplotlib y-axis scale, e.g.
"log"or"linear". -
eq_kwargs(Any, default:{}) –Extra equilibrium model options. Defaults to a single FDM step.
Returns:
-
losses(Float[Array, iterations]) –The total loss at each iteration.
Notes
Equilibrium is recomputed with a dense model vmapped over the history, since the sparse model does not support vmap.
print_error_stats
staticmethod
¤
print_error_stats(errors: Float[Array, iterations], error_name: str) -> None
Print first, last, min, and max of an error series.
Parameters:
-
errors(Float[Array, iterations]) –The error value at each iteration.
-
error_name(str) –The label to print the statistics under.