We have code that ran fine in 1.1.1 that raises an exception in colorbar
in 1.2.1 and 1.3.1. I have appended an example; I'm afraid it is rather
extreme, but we have seen this for arrays that have more than one
non-masked values as well, even with the values not all being equal.
Should I report this as a bug? Should we guard all our calls to colormap
with try/except, or perhaps there's a flag we can set that says "do your
best"? (But I don't see anything like that in the docs).
-- Russell
cmap = getattr(cm, cmap)
cmap.set_bad('k', 0.2)
if cmapOver is not None:
cmap.set_over(cmapOver, 1.0)
if cmapUnder is not None:
cmap.set_under(cmapUnder, 1.0)
p = PatchCollection(patches, norm=norm, cmap=cmap)
value_array = numpy.array(values)
masked_value_array =
numpyMa.masked_where(numpy.isnan(value_array), value_array)
p.set_array(masked_value_array)
cb = self.fig.colorbar(p)
File
"/nfs/lsst/home/rowen/code/testing_pipeQA/python/lsst/testing/pipeQA/figu
res/FpaQaFigure.py", line 317, in makeFigure
cb = self.fig.colorbar(p)
File
"/lsst/DC3/stacks/gcc445-RH6/28nov2011/Linux64/external/matplotlib/1.3.1+
1/lib/python/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/figure.py
", line 1451, in colorbar
cb = cbar.colorbar_factory(cax, mappable, **kw)
File
"/lsst/DC3/stacks/gcc445-RH6/28nov2011/Linux64/external/matplotlib/1.3.1+
1/lib/python/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/colorbar.
py", line 1274, in colorbar_factory
cb = Colorbar(cax, mappable, **kwargs)
File
"/lsst/DC3/stacks/gcc445-RH6/28nov2011/Linux64/external/matplotlib/1.3.1+
1/lib/python/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/colorbar.
py", line 877, in __init__
ColorbarBase.__init__(self, ax, **kw)
File
"/lsst/DC3/stacks/gcc445-RH6/28nov2011/Linux64/external/matplotlib/1.3.1+
1/lib/python/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/colorbar.
py", line 317, in __init__
self.draw_all()
File
"/lsst/DC3/stacks/gcc445-RH6/28nov2011/Linux64/external/matplotlib/1.3.1+
1/lib/python/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/colorbar.
py", line 342, in draw_all
self._config_axes(X, Y)
File
"/lsst/DC3/stacks/gcc445-RH6/28nov2011/Linux64/external/matplotlib/1.3.1+
1/lib/python/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/colorbar.
py", line 433, in _config_axes
self.update_ticks()
File
"/lsst/DC3/stacks/gcc445-RH6/28nov2011/Linux64/external/matplotlib/1.3.1+
1/lib/python/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/colorbar.
py", line 367, in update_ticks
ticks, ticklabels, offset_string = self._ticker()
File
"/lsst/DC3/stacks/gcc445-RH6/28nov2011/Linux64/external/matplotlib/1.3.1+
1/lib/python/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/colorbar.
py", line 580, in _ticker
ticks = self._locate(b)
File
"/lsst/DC3/stacks/gcc445-RH6/28nov2011/Linux64/external/matplotlib/1.3.1+
1/lib/python/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/colorbar.
py", line 829, in _locate
z = np.take(y, i0) + (xn - np.take(b, i0)) * dy / db
FloatingPointError: invalid value encountered in divide
Where masked_value_array=[-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
···
--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
0.7598040968345164 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--]