[Numpy-discussion] Is this a bug in numpy.ma.reduce?

David Goldsmith d.l.goldsmith@gmail....
Fri Mar 5 03:38:58 CST 2010


Hi!  Sorry for the cross-post, but my own investigation has led me to
suspect that mine is actually a numpy problem, not a matplotlib problem.
I'm getting the following traceback from a call to matplotlib.imshow:

Traceback (most recent call last):
 File
"C:\Users\Fermat\Documents\Fractals\Python\Source\Zodiac\aquarius_test.py",
line 108, in <module>
ax.imshow(part2plot, cmap_name, extent = extent)
 File "C:\Python254\lib\site-packages\matplotlib\axes.py", line 6261, in
imshow
im.autoscale_None()
 File "C:\Python254\lib\site-packages\matplotlib\cm.py", line 236, in
autoscale_None
self.norm.autoscale_None(self._A)
 File "C:\Python254\lib\site-packages\matplotlib\colors.py", line 792, in
autoscale_None
if self.vmin is None: self.vmin = ma.minimum(A)
 File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5555, in
__call__
return self.reduce(a)
 File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5570, in
reduce
t = self.ufunc.reduce(target, **kargs)
ValueError: zero-size array to ufunc.reduce without identity
Script terminated.

Based on examination of the code, the last self is an instance of
ma._extrema_operation (or one of its subclasses) - is there a reason why
this class is unable to deal with a "zero-size array to ufunc.reduce without
identity," (i.e., was it thought that it would - or should - never get one)
or was this merely an oversight?  Either way, there's other instances on the
lists of this error cropping up, so this circumstance should probably be
handled more robustly.  In the meantime, workaround?

DG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100305/f43c1446/attachment.html 


More information about the NumPy-Discussion mailing list