Hi, folks! Let's see, first the tech stuff: Python version - 2.5.4; matplotlib version - 0.99.0; numpy version - 1.4.0; Platform: 32 bit Windows Vista Home Premium SP2.
OK, now for the problem: imshow is (indirectly) raising "ValueError: zero-size array to ufunc.reduce without identity." Here's the traceback:
Traceback (most recent call last):
File "<mycode>", 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.
And here's the "local" code (it may be difficult to generate a self-contained reproducer of the problem, so I'm postponing that 'til it appears absolutely necessary):
ax.hold(True)
for i in range(4):
for j in range(4):
part2plot = argW[j*ny/4:(j+1)*ny/4, i*nx/4:(i+1)*nx/4]
if N.any(N.logical_not(N.isfinite(part2plot))):
print i, j,
print N.argwhere(N.logical_not(N.isfinite(part2plot)))
extent = (i*nx/4, (i+1)*nx/4, (j+1)*ny/4, j*ny/4)
ax.imshow(part2plot, cmap_name, extent = extent)
I added the print statements because Googling the error, I found an indication that if my image array contained any NaN's, that might be the cause; sure enough, I did have some, but I eliminated them, and now nothing gets printed before the exception is raised, so, unless I'm missing something obvious (wouldn't be the first time ;-)) something else is the problem.
Any ideas? Thanks!
DG