[SciPy-user] strange interaction between scipy.stats and scipy.optimize.minpack

Giulio Bottazzi giulio.bottazzi@gmail....
Mon Dec 3 16:32:07 CST 2007


Hi all,
I don't know if it has been already reported but I've noticed a
strange behavior. Consider the following script

#START of fit.py ----------------------

from numpy import array
import scipy.stats
from scipy.optimize.minpack import leastsq

empfreq=array([.31,.57,.12])

def thempdiff(p):
    thfreq   = array([(1-p[0])*(1-p[0]), 2*(1-p[0])*p[0],p[0]*p[0] ])
    return thfreq - empfreq

print leastsq(thempdiff,x0=[.5], full_output=1)

#END of fit.py -------------------------

now running it I obtain a seg fault

> python fit.py
zsh: segmentation fault  python fit.py

If instead

1) I remove the line "import scipy.stats" or

2) I remove the option "full_output=1" from leastsq

the script runs smoothly. I don't understand what's going on. Is
somebody else able to reproduce it? Any help?

Giulio.

-- 
Giulio Bottazzi <giulio.bottazzi@gmail.com>
http://giulio.bottazzi.googlepages.com
PGP Key ID:BAB0A33F


More information about the SciPy-user mailing list