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: Returns a QtGui.QLinearGradient corresponding to this ColorMap.
  The span and orientation is given by two points in plot coordinates.
  
  When no parameters are given for `p1` and `p2`, the gradient is mapped to the
  `y` coordinates 0 to 1, unless the color map is defined for a more limited range.
  
  This is a somewhat expensive operation, and it is recommended to store and reuse the returned
  gradient instead of repeatedly regenerating it.
  
  Parameters
  ----------
  p1: QtCore.QPointF, optional
      Starting point (value 0) of the gradient. Default value is QPointF(0., 0.)
  p2: QtCore.QPointF, optional
      End point (value 1) of the gradient. Default parameter `dy` is the span of ``max(pos) - min(pos)``
      over which the color map is defined, typically `dy=1`.  Default is QPointF(dy, 0.)
docstr_tok: ["Returns","a","QtGui.QLinearGradient","corresponding","to","this","ColorMap",".","The","span","and","orientation","is","given","by","two","points","in","plot","coordinates",".","When","no","parameters","are","given","for","`","p1","`","and","`","p2","`",",","the","gradient","is","mapped","to","the","`","y","`","coordinates","0","to","1",",","unless","the","color","map","is","defined","for","a","more","limited","range",".","This","is","a","somewhat","expensive","operation",",","and","it","is","recommended","to","store","and","reuse","the","returned","gradient","instead","of","repeatedly","regenerating","it",".","Parameters","--","--","--","--","--","p1",":","QtCore.QPointF",",","optional","Starting","point","(","value","0",")","of","the","gradient",".","Default","value","is","QPointF","(","0.",",","0",".",")","p2",":","QtCore.QPointF",",","optional","End","point","(","value","1",")","of","the","gradient",".","Default","parameter","`","dy","`","is","the","span","of","``","max","(","pos",")","-","min","(","pos",")","``","over","which","the","color","map","is","defined",",","typically","`","dy=1","`",".","Default","is","QPointF","(","dy",",","0",".",")"]
code: def getGradient(self, p1=None, p2=None):
      """
      Returns a QtGui.QLinearGradient corresponding to this ColorMap.
      The span and orientation is given by two points in plot coordinates.
  
      When no parameters are given for `p1` and `p2`, the gradient is mapped to the
      `y` coordinates 0 to 1, unless the color map is defined for a more limited range.
  
      This is a somewhat expensive operation, and it is recommended to store and reuse the returned
      gradient instead of repeatedly regenerating it.
  
      Parameters
      ----------
      p1: QtCore.QPointF, optional
          Starting point (value 0) of the gradient. Default value is QPointF(0., 0.)
      p2: QtCore.QPointF, optional
          End point (value 1) of the gradient. Default parameter `dy` is the span of ``max(pos) - min(pos)``
          over which the color map is defined, typically `dy=1`.  Default is QPointF(dy, 0.)
      """
      if p1 is None:
          p1 = QtCore.QPointF(0, 0)
      if p2 is None:
          p2 = QtCore.QPointF(self.pos.max() - self.pos.min(), 0)
      grad = QtGui.QLinearGradient(p1, p2)
  
      pos, color = self.getStops(mode=self.QCOLOR)
      if self.mapping_mode == self.MIRROR:
          pos_n = (1.0 - np.flip(pos)) / 2
          col_n = np.flip(color, axis=0)
          pos_p = (1.0 + pos) / 2
          col_p = color
          pos = np.concatenate((pos_n, pos_p))
          color = np.concatenate((col_n, col_p))
      grad.setStops(list(zip(pos, color)))
      if self.mapping_mode == self.REPEAT:
          grad.setSpread(QtGui.QGradient.Spread.RepeatSpread)
      return grad
  
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 13 for calling the ColorMap obj's underlying member method code with example usage: obj.getGradient(p1, p2) and returns: grad