[SciPy-user] Event handling in odeint

Rob Clewley rob.clewley@gmail....
Sun Nov 9 20:59:01 CST 2008


Hi Nils,

> Thank you for your prompt response.

sorry this new reply was a lot less prompt. I was making sure a small
bug was fixed in exactly this code before I mentioned it again.

> Is there an example illustrating the handling of events ?

In the previously-mentioned SVN's new file vode_event_test1.py, you
can see an example where an integration-terminating event is defined
like this

ev_args_term = {'name': 'threshold',
           'eventtol': 1e-4,
           'eventdelay': 1e-5,
           'starttime': 0,
           'active': True,
           'term': True,
           'precise': True}
thresh_ev_term = Events.makeZeroCrossEvent('w-p_thresh',
                        -1, ev_args_term, varnames=['w'], parnames=['p_thresh'])

This creates a threshold event that triggers when the ODE variable w
*decreases* through the value p_thresh. For details, including how
this is related to the ODE definition, see the PyDSTool wiki page
Events and the SVN file. After integration of the ODE, you might do
this:

>>> term_evs_found = testODE.getEvents()['threshold']
>>> term_evs_found.info()
Pointset <no name> (parameterized)
Independent variable:
t:  [ 2.3469947]
Coordinates:
w:  [-0.25000045]
Labels by index: Empty

-Rob


More information about the SciPy-user mailing list