Closed
Description
It seems that Numpy 1.17.0 produces a IndexError: invalid index to scalar variable.
in test_colors.py
(testing failure trace log):
FAILED lib/matplotlib/tests/test_colors.py::test_light_source_masked_shading
def test_light_source_masked_shading():
"""Array comparison test for a surface with a masked portion. Ensures that
we don't wind up with "fringes" of odd colors around masked regions."""
y, x = np.mgrid[-1.2:1.2:8j, -1.2:1.2:8j]
z = 10 * np.cos(x**2 + y**2)
z = np.ma.masked_greater(z, 9.9)
cmap = plt.cm.copper
ls = mcolors.LightSource(315, 45)
> rgb = ls.shade(z, cmap)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-6-96ee2a102cfd> in <module>
1 cmap = plt.cm.copper
2 ls = mcolors.LightSource(315, 45)
----> 3 rgb = ls.shade(z, cmap)
~/visualization/matplotlib/lib/matplotlib/colors.py in shade(self, data, cmap, norm, blend_mode, vmin, vmax, vert_exag, dx, dy, fraction, **kwargs)
1800 rgb1 = self.shade_rgb(rgb0, elevation=data, blend_mode=blend_mode,
1801 vert_exag=vert_exag, dx=dx, dy=dy,
-> 1802 fraction=fraction, **kwargs)
1803 # Don't overwrite the alpha channel, if present.
1804 rgb0[..., :3] = rgb1[..., :3]
~/visualization/matplotlib/lib/matplotlib/colors.py in shade_rgb(self, rgb, elevation, fraction, blend_mode, vert_exag, dx, dy, **kwargs)
1871 # Only apply result where hillshade intensity isn't masked
1872 if hasattr(intensity, 'mask'):
-> 1873 mask = intensity.mask[..., 0]
1874 for i in range(3):
1875 blend[..., i][mask] = rgb[..., i][mask]
IndexError: invalid index to scalar variable.
Metadata
Metadata
Assignees
Labels
No labels