[SciPy-dev] Bug in Mplot.py

Travis Oliphant oliphant.travis at ieee.org
Tue Feb 18 00:11:12 EST 2003


> 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


Thanks for this help.

> 
> 
> 
> 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...

Yes, I agree, I've tried this in the past but pychecker returns so many
spurious errors that it can be very time consuming to sort through the
valid ones.  If anyone knows more about pychecker and could turn down
the error reporting a bit and would like to post the errors it finds,
that would be great.

-Travis O.






More information about the SciPy-Dev mailing list