[SciPy-user] strange interaction between scipy.stats and scipy.optimize.minpack
Nils Wagner
nwagner at iam.uni-stuttgart.de
Tue Dec 4 02:15:12 EST 2007
On Mon, 3 Dec 2007 23:32:07 +0100
"Giulio Bottazzi" <giulio.bottazzi at gmail.com> wrote:
> 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
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
I cannot reproduce your problem.
>>> numpy.__version__
'1.0.5.dev4528'
>>> scipy.__version__
'0.7.0.dev3610'
python fit.py
(0.42369157713188349, array([[ 0.46734154]]), {'qtf':
array([ -4.51744596e-06]), 'nfev': 17, 'fjac': array([[
1.46279277, -0.20867347, -0.5792871 ]]), 'fvec': array([
0.0221314 , -0.08164595, 0.05951455]), 'ipvt': array([1],
dtype=int32)}, 'Both actual andpredicted relative
reductions in the sum of squares\n are at most 0.000000',
1)
Nils
More information about the SciPy-User
mailing list