I am trying to fit a differential equation to some data and obtain the parameters of the underlying model. This requires me to try out various parameter values, but this often gives me an ODEintWarning. Having a few of these warnings is OK, but having too many will cause my program to crash quite often (I work using Spyder and if I click somewhere on the GUI while the program is running, Spyder will freeze).
Is there a way to detect an ODEintWarning and escape it? In pseudocode, I essentially want something like:
for parameter in parameters_list: try: x = odeint(dxdt, x0,t, *parameters) except (at the first sign of an) ODEintWarning: pass (and go on to the next set of parameters to be tested)
Or, is my best option to detect bad parameter values in advance and try not to feed them into ODEint in the first place?