[Tutor] question on numarray in python

Xiangyi Meng wpmxy at sbcglobal.net
Sat Jul 30 00:01:19 CEST 2005


Hi there,

I ran across this error when running a few lines of 
code in debian python, but this runs perfectly in
windows python. Basically I created a dummy matrix
called "gamma" (using kroneckerproduct in numarray)
and printed out its mean.  Here is the code:
gamma = kroneckerproduct(ones((N, 1)),identity(T))
print gamma.mean()

and Here is the error message:
Traceback (most recent call last):
  File "vul_prov.py", line 149, in ?
    VLs = mv_prov(hhc, idyrisk, provid, 1)
  File
"/home/meng/China/Extent/Data/Urban2002/Empirics/tmp/vulnerability.py",
line 605, in mv_prov
    print gamma.mean()
  File
"/usr/lib/python2.4/site-packages/numarray/numarraycore.py",
line 1137, in mean
    return self.sum()/(self.nelements()*1.0)
  File
"/usr/lib/python2.4/site-packages/numarray/numarraycore.py",
line 1133, in sum
    return ufunc.add.reduce(ufunc.add.areduce(self,
type=type).flat, type=type)
IndexError: too many indices.

Thank you for helping on this! Oh, btw, the version
for python in both platforms is 2.4.1

Xiangyi



More information about the Tutor mailing list