Base class for callbacks, for documenting callback methods.
Callbacks are used to perform actions (e.g. logging, saving) at certain points in the simulation. Each callback method is named on_<event>, where <event> describes the point at which the callback is called. For example, the callback on_experiment_start is called at the start of an experiment simulation. In general, callbacks take a single argument, logs, which is a dictionary of information about the simulation. Each callback method should return None (the output of the method is ignored).
EXPERIMENTAL - this class is experimental and the callback interface may change in future releases.
Container abstracting a list of callbacks, so that they can be called in a single step e.g. callbacks.on_simulation_end(…).
This is done without having to redefine the method each time by using the callback_loop_decorator decorator, which is applied to every method that starts with on_, using the inspect module. See https://stackoverflow.com/questions/1367514/how-to-decorate-a-method-inside-a-class.
If better control over how the callbacks are called is required, it might be better to be more explicit with the for loop.
Called at the end of each cycle in an experiment simulation.
Called at the start of each cycle in an experiment simulation.
Called at the end of an experiment simulation.
Called when a SolverError occurs during an experiment simulation.
For example, this could be used to send an error alert with a bug report when running batch simulations in the cloud.
Called when an experiment simulation is infeasible.
Called at the start of an experiment simulation.
Called at the end of each step in an experiment simulation.
Called at the start of each step in an experiment simulation.
Logging callback, implements methods to log progress of the simulation.
logfile (str, optional) – Where to send the log output. If None, uses pybamm’s logger.
**Extends (** pybamm.callbacks.Callback
) –