ocelot.gui.colormaps2d.colormap2d

This script contains the colormap2d functions.

M Meschede 2016 https://github.com/MMesch/cmap_builder

Module Contents

Functions

data2d_to_rgb(data, cmap2d='brightwheel', huenorm=None, huevmin=None, huevmax=None, fill_value=(1.0, 1.0, 1.0), lightnorm=None, lightvmin=None, lightvmax=None)

Map 2 parameter 2D data array to rgb values.

imshow2d(data, ax=None, cmap2d='brightwheel', huenorm=None, huevmin=None, huevmax=None, lightnorm=None, lightvmin=None, lightvmax=None, **kwargs)

Plot 2 parameter 2D data array to current axis.

get_cmap2d(name)

Return 2d colormap as [nwidth, nheight, 4] numpy array.

ocelot.gui.colormaps2d.colormap2d.data2d_to_rgb(data, cmap2d='brightwheel', huenorm=None, huevmin=None, huevmax=None, fill_value=1.0, 1.0, 1.0, lightnorm=None, lightvmin=None, lightvmax=None)

Map 2 parameter 2D data array to rgb values.

Parameters
  • data – numpy array with shape (2, nwidth, nheight). The first index corresponds to the hue and the second to the lightness of the colors.

  • cmap2d – either: numpy array with shape (nwidth, nheight, 4) that contains the 4 rgba values in hue (width) and lightness (height). Can be obtained by a call to get_cmap2d(name). or: name where name is one of the following strings: ‘brightwheel’, ‘darkwheel’, ‘hardwheel’, ‘newwheel’, ‘smoothwheel’, ‘wheel’

  • huenorm – a plt.Normalize() instance that normalizes the hue values.

  • huevmin – the minimum of the huevalues. Only used if huenorm=None.

  • huevmax – the maximum of the huevalues. Only used if huenorm=None.

  • fill_value – e.g. (0., 0., 0.) for values that are not finite as nan

  • lightnorm – a plt.Normalize() instance that normalizes the lightness values.

  • lightvmin – the minimum of the lightness values. Only used if lightnorm=None.

  • lightvmax – the maximum of the lightness values. Only used if lightnorm=None.

Returns

numpy array with shape (3, nwidth, nheight) that can be plotted with imshow

ocelot.gui.colormaps2d.colormap2d.imshow2d(data, ax=None, cmap2d='brightwheel', huenorm=None, huevmin=None, huevmax=None, lightnorm=None, lightvmin=None, lightvmax=None, **kwargs)

Plot 2 parameter 2D data array to current axis.

Parameters
  • data – numpy array with shape (2, nwidth, nheight). The first index corresponds to the hue and the second to the lightness of the colors.

  • ax – a matplotlib axis instance.

  • cmap – either: numpy array with shape (nwidth, nheight, 4) that contains the 4 rgba values in hue (width) and lightness (height). Can be obtained by a call to get_cmap2d(name). or: name where name is one of the following strings: ‘brightwheel’, ‘darkwheel’, ‘hardwheel’, ‘newwheel’, ‘smoothwheel’, ‘wheel’

  • huenorm – a plt.Normalize() instance that normalizes the hue values.

  • huevmin – the minimum of the huevalues. Only used if huenorm=None.

  • huevmax – the maximum of the huevalues. Only used if huenorm=None.

  • lightnorm – a plt.Normalize() instance that normalizes the lightness values.

  • lightvmin – the minimum of the lightness values. Only used if lightnorm=None.

  • lightvmax – the maximum of the lightness values. Only used if lightnorm=None.

  • **kwargs

    remaining kwargs are passed to plt.imshow()

ocelot.gui.colormaps2d.colormap2d.get_cmap2d(name)

Return 2d colormap as [nwidth, nheight, 4] numpy array.

Parameters

name – can be one of the following strings: ‘brightwheel’, ‘darkwheel’, ‘hardwheel’, ‘newwheel’, ‘smoothwheel’, ‘wheel’