[SciPy-dev] Bug in Mplot.py

Fernando Perez fperez at pizero.colorado.edu
Fri Feb 14 21:51:21 CST 2003


Hi all,

In [16]: xplt.imagesc_cb(K,palette=array([0,1]))
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

?

/usr/lib/python2.2/site-packages/scipy/xplt/Mplot.py in imagesc_cb(z, cmin, 
cmax, xryr, _style, zlabel, font, fontsize, color, palette)
    928     cmin = float(cmin)
    929
--> 930     change_palette(palette)
    931
    932     byteimage = gist.bytscl(z,cmin=cmin,cmax=cmax)

/usr/lib/python2.2/site-packages/scipy/xplt/Mplot.py in change_palette(pal)
    603         else:
    604             data = Numeric.asarray(pal)
--> 605             write_palette('/tmp/_temp.gp',data)
    606             gist.palette('/tmp/_temp.gp')
    607

/usr/lib/python2.2/site-packages/scipy/xplt/Mplot.py in write_palette(tofile, 
pal)
    549         palsize = pal.shape
    550     if len(palsize) == 1:
--> 551         pal = multiply.outer(pal,ones((3,),pal.typecode()))
    552         palsize = pal.shape
    553     if not (palsize[1] == 3 or palsize[0] == 3):

NameError: global name 'multiply' is not defined



It seems that this code was written thinking of a from Numeric import * and 
later was changed without testing. I added 'multiply,ones' to the from Numeric 
import ... line and it fixed the crashes I saw, but there may be other 
problems lurking.  A pychecker run on all the scipy codes would probably be a 
good idea...

Cheers,

f.




More information about the Scipy-dev mailing list