code: def colorize(
      array, cmin=None, cmax=None, cmap="magma", eps=1e-6, invert=False
  ):
      """Applies a colormap to an array.
  
      Args:
        array: the array to apply a colormap to.
        cmin: the minimum value of the colormap. If None will take the min.
        cmax: the maximum value of the colormap. If None will take the max.
        cmap: the color mapping to use.
        eps: a small value to prevent divide by zero.
        invert: if True will invert the colormap.
  
      Returns:
        a color mapped version of array.
      """
      array = np.asarray(array)
  
      if cmin is None:
          cmin = array.min()
      if cmax is None:
          cmax = array.max()
  
      x = scale_values(array, cmin, cmax, eps)
      colormap = get_colormap(cmap)
      colorized = interpolate_colormap(
          1.0 - x if invert else x, colormap
      )
      colorized[x > 1.0] = 0.0 if invert else 1.0
      colorized[x < 0.0] = 1.0 if invert else 0.0
  
      return colorized
  
file_path: nerfies/nerfies/visualization.py
imports: import functools
  from matplotlib import cm
  from matplotlib.colors import LinearSegmentedColormap
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: colorize(array, cmin, cmax, cmap, eps, invert) and returns: colorized