[SciPy-user] unhandled exception ind leastsq

Christian Kristukat ckkart at hoc.net
Wed Apr 20 05:38:44 CDT 2005

a couple of weeks ago there was some discussion about calculating the covariance
from the result of lmdif/lmder and eventually some code was added to the
leastsq() function. I propose that an exception handler for the following error
should be added which occurs when the data has very little noise::

   File "/usr/lib/python2.3/site-packages/scipy/optimize/minpack.py", line 255,
in leastsq
     cov_x = sl.inv(dot(transpose(R),R))
   File "/usr/lib/python2.3/site-packages/scipy/linalg/basic.py", line 216, in inv
     if info>0: raise LinAlgError, "singular matrix"
scipy.linalg.basic.LinAlgError: singular matrix

Anyway, as we finally have the covariance matrix, could explain to me how I get
a e.g. 95% confidence interval?

Regards, Christian

More information about the SciPy-user mailing list