class_docstr: ColorMap(pos, color, mapping=ColorMap.CLIP)
  
  ColorMap stores a mapping of specific data values to colors, for example:
  
      | 0.0 → black
      | 0.2 → red
      | 0.6 → yellow
      | 1.0 → white
  
  The colors for intermediate values are determined by interpolating between
  the two nearest colors in RGB color space.
  
  A ColorMap object provides access to the interpolated colors by indexing with a float value:
  ``cm[0.5]`` returns a QColor corresponding to the center of ColorMap `cm`.
docstr: map(data, mode=ColorMap.BYTE)
  
  Returns an array of colors corresponding to a single value or an array of values.
  Data must be either a scalar position or an array (any shape) of positions.
  
  Parameters
  ----------
  data: float or array_like of float
      Scalar value(s) to be mapped to colors
  
  mode: str or int, optional
      Determines return format:
  
        - `ColorMap.BYTE` or 'byte': Colors are returned as 0-255 unsigned bytes. (default)
        - `ColorMap.FLOAT` or 'float': Colors are returned as 0.0-1.0 floats.
        - `ColorMap.QCOLOR` or 'qcolor': Colors are returned as QColor objects.
  
  Returns
  -------
  np.ndarray of {``ColorMap.BYTE``, ``ColorMap.FLOAT``, QColor}
      for `ColorMap.BYTE` or `ColorMap.FLOAT`:
  
      RGB values for each `data` value, arranged in the same shape as `data`.
  list of QColor
      for `ColorMap.QCOLOR`:
  
      Colors for each `data` value as QColor objects.
docstr_tok: ["map","(","data",",","mode=ColorMap.BYTE",")","Returns","an","array","of","colors","corresponding","to","a","single","value","or","an","array","of","values",".","Data","must","be","either","a","scalar","position","or","an","array","(","any","shape",")","of","positions",".","Parameters","--","--","--","--","--","data",":","float","or","array_like","of","float","Scalar","value","(","s",")","to","be","mapped","to","colors","mode",":","str","or","int",",","optional","Determines","return","format",":","-","`","ColorMap.BYTE","`","or","'byte","'",":","Colors","are","returned","as","0-255","unsigned","bytes",".","(","default",")","-","`","ColorMap.FLOAT","`","or","'float","'",":","Colors","are","returned","as","0.0-1.0","floats",".","-","`","ColorMap.QCOLOR","`","or","'qcolor","'",":","Colors","are","returned","as","QColor","objects",".","Returns","--","--","--","-","np.ndarray","of","{","``","ColorMap.BYTE","``",",","``","ColorMap.FLOAT","``",",","QColor","}","for","`","ColorMap.BYTE","`","or","`","ColorMap.FLOAT","`",":","RGB","values","for","each","`","data","`","value",",","arranged","in","the","same","shape","as","`","data","`",".","list","of","QColor","for","`","ColorMap.QCOLOR","`",":","Colors","for","each","`","data","`","value","as","QColor","objects","."]
code: def map(self, data, mode=BYTE):
      """
      map(data, mode=ColorMap.BYTE)
  
      Returns an array of colors corresponding to a single value or an array of values.
      Data must be either a scalar position or an array (any shape) of positions.
  
      Parameters
      ----------
      data: float or array_like of float
          Scalar value(s) to be mapped to colors
  
      mode: str or int, optional
          Determines return format:
  
            - `ColorMap.BYTE` or 'byte': Colors are returned as 0-255 unsigned bytes. (default)
            - `ColorMap.FLOAT` or 'float': Colors are returned as 0.0-1.0 floats.
            - `ColorMap.QCOLOR` or 'qcolor': Colors are returned as QColor objects.
  
      Returns
      -------
      np.ndarray of {``ColorMap.BYTE``, ``ColorMap.FLOAT``, QColor}
          for `ColorMap.BYTE` or `ColorMap.FLOAT`:
  
          RGB values for each `data` value, arranged in the same shape as `data`.
      list of QColor
          for `ColorMap.QCOLOR`:
  
          Colors for each `data` value as QColor objects.
      """
      if isinstance(mode, str):
          mode = self.enumMap[mode.lower()]
  
      if mode == self.QCOLOR:
          pos, color = self.getStops(self.FLOAT)
      else:
          pos, color = self.getStops(mode)
  
      if np.isscalar(data):
          interp = np.empty((color.shape[1],), dtype=color.dtype)
      else:
          if not isinstance(data, np.ndarray):
              data = np.array(data)
          interp = np.empty(
              data.shape + (color.shape[1],), dtype=color.dtype
          )
  
      if self.mapping_mode != self.CLIP:
          if self.mapping_mode == self.REPEAT:
              data = data % 1.0
          elif self.mapping_mode == self.DIVERGING:
              data = (data / 2) + 0.5
          elif self.mapping_mode == self.MIRROR:
              data = abs(data)
  
      for i in range(color.shape[1]):
          interp[..., i] = np.interp(data, pos, color[:, i])
  
      # Convert to QColor if requested
      if mode == self.QCOLOR:
          if np.isscalar(data):
              return QtGui.QColor.fromRgbF(*interp)
          else:
              return [
                  QtGui.QColor.fromRgbF(*x.tolist()) for x in interp
              ]
      else:
          return interp
  
imports: from collections.abc import Callable, Sequence
  from os import listdir, path
  import numpy
  from .functions import clip_array, clip_scalar, colorDistance, eq, mkColor
  from .Qt import QtCore, QtGui
label_desc: Use image node_id 8 for calling the ColorMap obj's underlying member method code with example usage: obj.map(data, mode) and returns: interp, QtGui, unknown