NumPy error

J

jason

Hello:

I am using the following versions of Python and packages on Windows XP
(SP2):

Python 2.4.2
NumPy 0.9.4.win32-py2.4
SciPy 0.4.4 for Python 2.4 and Pentium 4/SSE2

In the Python Shell I am running the following:
return sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0)
x0 = [1.3, 0.7, 0.8, 1.9, 1.2]
xopt = fmin(rosen, x0)

I get the following error:

Traceback (most recent call last):
File "<pyshell#6>", line 1, in -toplevel-
xopt = fmin(rosen, x0)
File "C:\Python24\Lib\site-packages\scipy\optimize\optimize.py", line 191,
in fmin
sim = Num.zeros((N+1,N),x0.dtypechar)
AttributeError: 'numpy.ndarray' object has no attribute 'dtypechar'

Any idea what the problem might be?

Thanks.
 
D

Diez B. Roggisch

jason said:
Hello:

I am using the following versions of Python and packages on Windows XP
(SP2):

Python 2.4.2
NumPy 0.9.4.win32-py2.4
SciPy 0.4.4 for Python 2.4 and Pentium 4/SSE2

I fell for that yesterday. Cost me two hours. You have to install NumPy
0.9.2. Make sure you cleaned up the site-packages, and if you build stuff
yourself, a clean rebuild is necessary.

Regards,

Diez
 
J

jason

Thanks.

After executing the first line, I now get:
Overwriting fft=<function fft at 0x012116F0> from scipy.fftpack.basic (was
<function fft at 0x011C8A70> from numpy.dft.fftpack)
Overwriting ifft=<function ifft at 0x01211730> from scipy.fftpack.basic (was
<function inverse_fft at 0x011C8AB0> from numpy.dft.fftpack)

And then I get the following result:
Optimization terminated successfully.
Current function value: 0.000066
Iterations: 141
Function evaluations: 243
[ 0.99910115 0.99820923 0.99646346 0.99297555 0.98600385]

Two questions:
1. does the "overwriting..." message make sense?
I uninstalled scipy and numpy and re-installed them.

2. has the algorithm (accuracy level) changed? the result seems different
from that reported in
http://www.scipy.org/Wiki/Documentation?action=AttachFile&do=get&target=scipy_tutorial.pdf
on page 12.

Thanks again.
 
D

Diez B. Roggisch

from scipy.optimize import fmin
Overwriting fft=<function fft at 0x012116F0> from scipy.fftpack.basic (was
<function fft at 0x011C8A70> from numpy.dft.fftpack)
Overwriting ifft=<function ifft at 0x01211730> from scipy.fftpack.basic (was
<function inverse_fft at 0x011C8AB0> from numpy.dft.fftpack)

And then I get the following result:
Optimization terminated successfully.
Current function value: 0.000066
Iterations: 141
Function evaluations: 243
[ 0.99910115 0.99820923 0.99646346 0.99297555 0.98600385]

Two questions:
1. does the "overwriting..." message make sense?
I uninstalled scipy and numpy and re-installed them.

I get that too - and I have no clue what it means, but I consider it a
left-over warning or something like that.
2. has the algorithm (accuracy level) changed? the result seems different
from that reported in
http://www.scipy.org/Wiki/Documentation?action=AttachFile&do=get&target=scipy_tutorial.pdf
on page 12.

No idea.

Diez
 
R

Robert Kern

jason said:
Thanks.

After executing the first line, I now get:

Overwriting fft=<function fft at 0x012116F0> from scipy.fftpack.basic (was
<function fft at 0x011C8A70> from numpy.dft.fftpack)
Overwriting ifft=<function ifft at 0x01211730> from scipy.fftpack.basic (was
<function inverse_fft at 0x011C8AB0> from numpy.dft.fftpack)

And then I get the following result:

Optimization terminated successfully.
Current function value: 0.000066
Iterations: 141
Function evaluations: 243

[ 0.99910115 0.99820923 0.99646346 0.99297555 0.98600385]

Two questions:
1. does the "overwriting..." message make sense?

It's replacing the fft() and ifft() functions in numpy with the optimized
functions in scipy. I don't think we're doing that anymore in SVN scipy.
I uninstalled scipy and numpy and re-installed them.

2. has the algorithm (accuracy level) changed? the result seems different
from that reported in
http://www.scipy.org/Wiki/Documentation?action=AttachFile&do=get&target=scipy_tutorial.pdf
on page 12.

It is different. We're not really sure why. The simplex method is not an
algorithm known for its robustness.

Sorry about the confusion with dtypechar. Our releases of numpy and scipy got
out of sync.

--
Robert Kern
(e-mail address removed)

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

git_revision issues with scipy/numpy/matplotlib 3
integrate does not work anymore 1
SciPy Optimization syntax 1
numpy error 3
Numpy not found 1
Memory error 3
installing numpy 1
numpy help 2

Members online

No members online now.

Forum statistics

Threads
474,283
Messages
2,571,405
Members
48,098
Latest member
inno vation

Latest Threads

Top