4.7.1 pde.trackers.base module
Base classes for trackers
- exception FinishedSimulation[source]
Bases:
StopIteration
exception for signaling that simulation finished successfully
- class TrackerBase(interrupts=1, *, interval=None)[source]
Bases:
object
base class for implementing trackers
- Parameters:
interrupts (InterruptData) – Determines when the tracker interrupts the simulation. A single numbers determines an interval (measured in the simulation time unit) of regular interruption. A string is interpreted as a duration in real time assuming the format ‘hh:mm:ss’. A list of numbers is taken as explicit simulation time points. More fine- grained contol is possible by passing an instance of classes defined in
interrupts
.
- finalize(info=None)[source]
finalize the tracker, supplying additional information
- Parameters:
info (dict) – Extra information from the simulation
- Return type:
None
- classmethod from_data(data, **kwargs)[source]
create tracker class from given data
- Parameters:
data (str or TrackerBase) – Data describing the tracker
- Returns:
An instance representing the tracker
- Return type:
- abstract handle(field, t)[source]
handle data supplied to this tracker
- Parameters:
field (
FieldBase
) – The current state of the simulationt (float) – The associated time
- Return type:
None
- class TrackerCollection(trackers=None)[source]
Bases:
object
List of trackers providing methods to handle them efficiently
- Parameters:
trackers (list[TrackerBase] | None) – List of trackers that are to be handled.
- finalize(info=None)[source]
finalize the tracker, supplying additional information
- Parameters:
info (dict) – Extra information from the simulation
- Return type:
None
- classmethod from_data(data, **kwargs)[source]
create tracker collection from given data
- Parameters:
data (Sequence[TrackerBase | str] | TrackerBase | str | None) – Data describing the tracker collection
- Returns:
An instance representing the tracker collection
- Return type:
- handle(state, t, atol=1e-08)[source]
handle all trackers
- Parameters:
state (
FieldBase
) – The current state of the simulationt (float) – The associated time
atol (float) – An absolute tolerance that is used to determine whether a tracker should be called now or whether the simulation should be carried on more timesteps. This is basically used to predict the next time to decided which one is closer.
- Returns:
The next time the simulation needs to be interrupted to handle a tracker.
- Return type: