pastas.plotting.plots.TrackSolve ================================ .. toctree:: :hidden: /api/pastas/plotting/plots/TrackSolve.track_solve /api/pastas/plotting/plots/TrackSolve.initialize_figure /api/pastas/plotting/plots/TrackSolve.plot_track_solve /api/pastas/plotting/plots/TrackSolve.plot_track_solve_history .. py:class:: pastas.plotting.plots.TrackSolve(ml: pastas.typing.Model, tmin: pandas.Timestamp | str | None = None, tmax: pandas.Timestamp | str | None = None, update_iter: int | None = None) Track and/or visualize optimization progress for Pastas models. :param ml: pastas Model to track :type ml: pastas.model.Model :param tmin: start time for simulation, by default None which defaults to first index in ml.oseries.series :type tmin: pandas.Timestamp or str, optional :param tmax: end time for simulation, by default None which defaults to last index in ml.oseries.series :type tmax: pandas.Timestamp or str, optional :param update_iter: if visualizing optimization progress, update plot every update_iter iterations, by default nparam :type update_iter: int, optional .. rubric:: Notes Interactive plotting of optimization progress requires a matplotlib backend that supports interactive plotting, e.g. `mpl.use("TkAgg")` and `mpl.interactive( True)`. Some possible speedups on the matplotlib side include: - mpl.style.use("fast") - mpl.rcParams['path.simplify_threshold'] = 1.0 .. rubric:: Examples Set matplotlib backend and interactive mode (put this at the top of your script):: import matplotlib as mpl mpl.use("TkAgg") import matplotlib.pyplot as plt plt.ion() Create a TrackSolve object for your model:: track = TrackSolve(ml) Solve model and store intermediate optimization results:: ml.solve(callback=track.track_solve) Calculated parameters per iteration are stored in a pandas.DataFrame:: track.parameters Other stored statistics include `track.evp` (explained variance percentage), `track.rmse_res` (root-mean-squared error of the residuals), `track.rmse_noise` ( root mean squared error of the noise, only if noise=True). To interactively plot model optimization progress while solving pass `track.plot_track_solve` as callback function:: ml.solve(callback=track.plot_track_solve) Access the resulting figure through `track.fig`. .. !! processed by numpydoc !! Methods ------- .. autoapisummary:: pastas.plotting.plots.TrackSolve.track_solve pastas.plotting.plots.TrackSolve.initialize_figure pastas.plotting.plots.TrackSolve.plot_track_solve pastas.plotting.plots.TrackSolve.plot_track_solve_history