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

Giulio Bottazzi giulio.bottazzi at gmail.com
Mon Dec 3 17:32:07 EST 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 at gmail.com>
http://giulio.bottazzi.googlepages.com
PGP Key ID:BAB0A33F



More information about the SciPy-User mailing list