Quantcast

Is it possible to catch warnings from LSODA using a python warning filter?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is it possible to catch warnings from LSODA using a python warning filter?

PurpleStreetLamp
This post has NOT been accepted by the mailing list yet.
Hi there

I am using scipy.integrate.odeint to integrate a set of equations for varying, randomly selected sets of parameters. I am attempting to sample a parameter space for this system of DEs, but some of the parameter sets, result in a solution which contains a singularity. This usually leads to the following kind of message by lsoda:

lsoda--  warning..internal t (=r1) and h (=r2) are        
   such that in the machine, t + h = t on the next step
   (h = step size). solver will continue anyway        
  In above,  R1 =  0.2135341098625E-06   R2 =  0.1236845248713E-22

However, many times, the solver continues to try to solve the system. Is there a way to catch this warning, and break the integration as soon as the step size goes too small, in Python? I need to catch the warning, abandon the integration, so I can continue sampling the space of parameters, without worrying about singular points.

Thanks for any help!!
Loading...