[SciPy-user] segfault in scipy.optimize.leastsq

Dr. Hans Georg Krauthaeuser hgk at et.uni-magdeburg.de
Thu Aug 3 09:07:17 CDT 2006

```basvandijk at home.nl wrote:
> Hello,
>
> When running the following example from http://www.tau.ac.il/~kineret/amit/scipy_tutorial I get an segmentationfault in leastsq:
>
> --------------------------
> from scipy import *
> from numpy import *
>
> x = arange(0,6e-2,6e-2/30)
> A,k,theta = 10, 1.0/3e-2, pi/6s
> y_true = A*sin(2*pi*k*x+theta)
> y_meas = y_true + 2*randn(len(x))
>
> def residuals(p, y, x):
>     A,k,theta = p
>     err = y-A*sin(2*pi*k*x+theta)
>     return err
>
> def peval(x, p):
>     return p[0]*sin(2*pi*p[1]*x+p[2])
>
> p0 = [8, 1/2.3e-2, pi/3]
> print array(p0)
>
> from scipy.optimize import leastsq
> plsq = leastsq(residuals, p0, args=(y_meas, x))
> print plsq[0]
>
> print array([A, k, theta])
> --------------------------
>
> Note that C:\Python24\Lib\site-packages\scipy\optimize\tests\test_optimize.py also gives an error.
>
> I'm running Python 2.4.3, Scipy 0.5.0 and numpy 1.0b1.
>
> What can be the problem?
>
> Greetings,
>
> Bas van Dijk
Sounds familar to me. I had a similar problem with older scipy and numpy
versions. For me it worked after using ATLAS without SSE support. But
that was an ATHLON and not an Pentium 2.

You can find the old thred here:
http://thread.gmane.org/gmane.comp.python.scientific.user/8139/focus=8139

Hans Georg

```

More information about the SciPy-user mailing list