logs dictionary containing current simulation state.
pybamm.callbacks.Callback
Base class. Override any of the on_<event> methods in your subclass. Each method receives logs and should return None.
Hook methods
| Method | When called | Typical logs keys |
|---|---|---|
on_experiment_start | Before the first cycle | — |
on_cycle_start | Before each cycle | "cycle number", "elapsed time" |
on_step_start | Before each step within a cycle | "cycle number", "step number", "step operating conditions" |
on_step_end | After each step | "stopping conditions", "experiment time" |
on_cycle_end | After each cycle | "stopping conditions", "summary variables", "Minimum voltage [V]", "start capacity" |
on_experiment_end | After the final cycle | "elapsed time" |
on_experiment_error | When a SolverError occurs | "error" |
on_experiment_infeasible_time | Default duration reached without termination event | "step duration", "cycle number", "step number", "step operating conditions" |
on_experiment_infeasible_event | Termination event triggered before experiment completes | "termination", "cycle number", "step number", "step operating conditions" |
pybamm.callbacks.CallbackList
A container that holds multiple Callback objects and calls each one in sequence. Construct it with a list of callbacks:
CallbackList mirror those of Callback and automatically dispatch to every registered callback.
pybamm.callbacks.LoggingCallback
The default callback. Writes progress information to PyBaMM’s logger (or an optional log file).
Path to a log file. If
None, output is sent to pybamm.logger (stdout by default).LoggingCallback is automatically added to every simulation that does not already have one.