grayify_colormap

gammapy.image.grayify_colormap(cmap, mode='hsp')[source]

Return a grayscale version a the colormap.

The grayscale conversion of the colormap is bases on perceived luminance of the colors. For the conversion either the rgb2gray or a generic method called hsp [R1] can be used. The code is loosely based on [R2].

Parameters:

cmap : str or Colormap

Colormap name or instance.

mode : {‘skimage, ‘hsp’}

Grayscale conversion method. Either skimage or hsp.

References

[R1](1, 2) Darel Rex Finley, “HSP Color Model - Alternative to HSV (HSB) and HSL” http://alienryderflex.com/hsp.html
[R2](1, 2) Jake VanderPlas, “How Bad Is Your Colormap?” https://jakevdp.github.io/blog/2014/10/16/how-bad-is-your-colormap/