Implement callbacks in ODE functions
masterYou can trigger callbacks during a solve by defining specific methods on the func object passed to odeint or odeint_adjoint.
Supported Forward Callbacks:
callback_step(self, t0, y0, dt): Called immediately before taking a step. Supported by all solvers exceptscipy_solver.callback_accept_step(self, t0, y0, dt): Called when a step is accepted. Supported by adaptive solvers (dopri8,dopri5,bosh3,adaptive_heun).callback_reject_step(self, t0, y0, dt): Called when a step is rejected. Supported by adaptive solvers.
Adjoint Callbacks:
To trigger these during the adjoint pass, append _adjoint to the method name (e.g., callback_step_adjoint).