[SciPy-user] optimize.leastsq crashs my interpreter

Hans Georg Krauthäuser hgk at et.uni-magdeburg.de
Fri Jul 7 06:30:30 EDT 2006


Hi all,

I've tried to use optimize.leastsq from a fresh binary install of numpy 
and scipy with python 2.4 on XP. A call to optimize.leastsq results in 
the crash of the interpreter without any traceback. XP tells me that the 
problem occurs inside _minpack.pyd.

I can reproduce the error with the following script on two different 
computers
-------------------8<------------------------
import scipy
scipy.pkgload('optimize')

x=scipy.array([1., 2., 3.])
y=scipy.array([4., 5., 6.])

def res(p, y, x):
     err=y-peval(x,p)
     print p, y, x, err
     return err

def peval(x,p):
     return p[0]*x+p[1]

m_0=0.1
b_0=0.0

p0=scipy.array([m_0,b_0])
plsq=scipy.optimize.leastsq(res, p0, args=(y,x))

print plsq
--------------------->8---------------------------

If I comment out line 2 (pkgload) the script runs perfectly on an old 
python installation (2.3) with old scipy and numpy.

It would be nice if someone could try to reproduce the error.

Please tell me also if something is wrong with my script.

Regards
Hans Georg




More information about the SciPy-User mailing list