Skip to content

Commit

Permalink
Deprecate the Accent colormap, in anticipation of changes in MPL 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
arokem committed Mar 13, 2017
1 parent 32ed56b commit b914325
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dipy/data/__init__.py
Expand Up @@ -362,6 +362,9 @@ def mrtrix_spherical_functions():

def get_cmap(name):
"""Makes a callable, similar to maptlotlib.pyplot.get_cmap"""
if name.lower() == "accent":
raise ValueError("The `Accent` colormap is deprecated as of version",
" 0.12 of Dipy. Please use another colormap")
global dipy_cmaps
if dipy_cmaps is None:
filename = pjoin(DATA_DIR, "dipy_colormaps.json")
Expand Down
5 changes: 4 additions & 1 deletion dipy/viz/tests/test_fvtk.py
Expand Up @@ -109,14 +109,17 @@ def test_colormap():
@npt.dec.skipif(not fvtk.have_matplotlib)
def test_colormaps_matplotlib():
v = np.random.random(1000)
for name in 'jet', 'Blues', 'Accent', 'bone':
for name in 'jet', 'Blues', 'bone':
# Matplotlib version of get_cmap
rgba1 = fvtk.get_cmap(name)(v)
# Dipy version of get_cmap
rgba2 = data.get_cmap(name)(v)
# dipy's colormaps are close to matplotlibs colormaps, but not perfect
npt.assert_array_almost_equal(rgba1, rgba2, 1)

# The "Accent" colormap is deprecated as of 0.12:
npt.assert_raises(ValueError, data.get_cmap, 'Accent')


if __name__ == "__main__":

Expand Down

0 comments on commit b914325

Please sign in to comment.