[SciPy-user] numpy.asarray and Numeric.asarray
Steve Schmerler
elcorto at gmx.net
Tue Jan 24 05:29:51 EST 2006
Hi
Using optimize.fmin_powell from a recent svn build with the initial
guess x0 being a scalar I get this error:
Traceback (most recent call last):
File "trans.py", line 151, in ?
tau = fmin_powell(func, tau_start)
File "/usr/lib/python2.3/site-packages/scipy/optimize/optimize.py",
line 1453, in fmin_powell
N = len(x)
TypeError: len() of unsized object
where x = asarray(x0). Comparing numpy's and Numeric's asarray I found
===================================================================================
In [8]: import numpy as nu
In [9]: import Numeric as NU
In [10]: x = nu.asarray([1,2]); len(x)
Out[10]: 2
In [11]: y = NU.asarray([1,2]); len(y)
Out[11]: 2
In [12]: x = nu.asarray(3); len(x)
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most
recent call last)
/home/elcorto/<console>
TypeError: len() of unsized object
In [13]: y = NU.asarray(3); len(y)
Out[13]: 1
===================================================================================
cheers,
steve
--
"People like Blood Sausage too. People are Morons!" -- Phil Connors,
Groundhog Day
More information about the SciPy-User
mailing list