ct.colormap

Functions for querying matplotlib’s colormaps.

ct.colormap.query(values, colormap='viridis')[source]

Query matplotlib’s color map.

Parameters:
  • values (Float[ndarray, '*batch']) – Scalar values to map to colors. Valid range is [0, 1].

  • colormap (str) – Name of matplotlib color map.

Returns:

RGB colors corresponding to input values.

Raises:

ValueError – If values.dtype is not float32 or float64.

Return type:

Float[ndarray, ‘*batch 3’]

ct.colormap.normalize(array, vmin=0.0, vmax=1.0, clip=False)[source]

Normalize array to [vmin, vmax].

Parameters:
  • array (Float[ndarray, '*batch']) – Input array to normalize.

  • vmin (float) – Minimum value in output range.

  • vmax (float) – Maximum value in output range.

  • clip (bool) – If True, clip array to [vmin, vmax].

Returns:

Normalized array with same shape as input.

Return type:

Float[ndarray, ‘*batch’]