4.7 pde.trackers package

Classes for tracking simulation results in controlled interrupts.

Trackers are classes that periodically receive the state of the simulation to analyze, store, or output it. The trackers defined in this module are:

CallbackTracker

Tracker calling a function periodically.

ProgressTracker

Tracker showing the progress of the simulation.

PrintTracker

Tracker printing data to a stream (default: stdout)

PlotTracker

Tracker plotting data on screen, to files, or writes a movie.

LivePlotTracker

PlotTracker with defaults for live plotting.

DataTracker

Tracker storing custom data obtained by calling a function.

SteadyStateTracker

Tracker aborting the simulation once steady state is reached.

RuntimeTracker

Tracker interrupting the simulation once a duration has passed.

ConsistencyTracker

Tracker interrupting the simulation when the state is not finite.

InteractivePlotTracker

Tracker showing the state interactively in napari.

Some trackers can also be referenced by name for convenience when using them in simulations. The lit of supported names is returned by get_named_trackers().

Multiple trackers can be collected in a TrackerCollection, which provides methods for handling them efficiently. Moreover, custom trackers can be implemented by deriving from TrackerBase. Note that trackers generally receive a view into the current state, implying that they can adjust the state by modifying it in-place. Moreover, trackers can abort the simulation by raising the special exception StopIteration.

For each tracker, the time at which the simulation is interrupted can be decided using one of the following classes:

FixedInterrupts

Class representing a list of interrupt times.

ConstantInterrupts

Class representing equidistantly spaced time interrupts.

LogarithmicInterrupts

Class representing logarithmically spaced time interrupts.

RealtimeInterrupts

Class representing time interrupts spaced equidistantly in real time.

In particular, interrupts can be specified conveniently using parse_interrupt().