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 new ColorMap object that extracts the subset specified by 'start' and 'length' 
  to the full 0.0 to 1.0 range. A negative length results in a color map that is reversed 
  relative to the original.
  
  Parameters
  ----------
  start : float
          Starting value that defines the 0.0 value of the new color map.
          Possible value between 0.0 to 1.0
  span  : float
          Span of the extracted region. The original color map will be 
          treated as cyclical if the extracted interval exceeds the 
          0.0 to 1.0 range.  Possible values between -1.0 to 1.0.
docstr_tok: ["Returns","a","new","ColorMap","object","that","extracts","the","subset","specified","by","'start","'","and","'length","'","to","the","full","0.0","to","1.0","range",".","A","negative","length","results","in","a","color","map","that","is","reversed","relative","to","the","original",".","Parameters","--","--","--","--","--","start",":","float","Starting","value","that","defines","the","0.0","value","of","the","new","color","map",".","Possible","value","between","0.0","to","1.0","span",":","float","Span","of","the","extracted","region",".","The","original","color","map","will","be","treated","as","cyclical","if","the","extracted","interval","exceeds","the","0.0","to","1.0","range",".","Possible","values","between","-1.0","to","1.0","."]
code: def getSubset(self, start, span):
      """
      Returns a new ColorMap object that extracts the subset specified by 'start' and 'length'
      to the full 0.0 to 1.0 range. A negative length results in a color map that is reversed
      relative to the original.
  
      Parameters
      ----------
      start : float
              Starting value that defines the 0.0 value of the new color map.
              Possible value between 0.0 to 1.0
      span  : float
              Span of the extracted region. The original color map will be
              treated as cyclical if the extracted interval exceeds the
              0.0 to 1.0 range.  Possible values between -1.0 to 1.0.
      """
      pos, col = self.getStops(mode=ColorMap.FLOAT)
      start = clip_scalar(start, 0.0, 1.0)
      span = clip_scalar(span, -1.0, 1.0)
  
      if span == 0.0:
          raise ValueError("'length' needs to be non-zero")
      stop = start + span
      if stop > 1.0 or stop < 0.0:
          stop = stop % 1.0
      # find indices *inside* range, start and end will be added by sampling later
      if span > 0:
          ref_pos = start  # lowest position value at start
          idxA = np.searchsorted(pos, start, side="right")
          idxB = np.searchsorted(
              pos, stop, side="left"
          )  # + 1 # right-side element of interval
          wraps = bool(stop < start)  # wraps around?
      else:
          ref_pos = stop  # lowest position value at stop
          idxA = np.searchsorted(pos, stop, side="right")
          idxB = np.searchsorted(
              pos, start, side="left"
          )  # + 1 # right-side element of interval
          wraps = bool(stop > start)  # wraps around?
  
      if wraps:  # wraps around:
          length1 = len(pos) - idxA  # before wrap
          length2 = idxB  # after wrap
          new_length = (
              length1 + length2 + 2
          )  # combined; plus edge elements
          new_pos = np.zeros(new_length)
          new_col = np.zeros((new_length, 4))
          new_pos[1 : length1 + 1] = (
              0 + pos[idxA:] - ref_pos
          ) / span  # starting point lie in 0 to 1 range
          new_pos[length1 + 1 : -1] = (
              1 + pos[:idxB] - ref_pos
          ) / span  # end point wrapped to -1 to 0 range
          new_pos[length1] -= np.copysign(
              1e-6, span
          )  # breaks degeneracy of shifted 0.0 and 1.0 values
          new_col[1 : length1 + 1] = col[idxA:]
          new_col[length1 + 1 : -1] = col[:idxB]
      else:  # does not wrap around:
          new_length = (
              idxB - idxA
          ) + 2  # two additional edge values will be added
          new_pos = np.zeros(new_length)
          new_col = np.zeros((new_length, 4))
          new_pos[1:-1] = (pos[idxA:idxB] - ref_pos) / span
          new_col[1:-1] = col[idxA:idxB]
  
      if (
          span < 0
      ):  # for reversed subsets, positions now progress 0 to -1 and need to be flipped
          new_pos += 1.0
          new_pos = np.flip(new_pos)
          new_col = np.flip(new_col, axis=0)
  
      new_pos[0] = 0.0
      new_col[0] = self.mapToFloat(start)
      new_pos[-1] = 1.0
      new_col[-1] = self.mapToFloat(stop)
  
      cmap = ColorMap(pos=new_pos, color=255.0 * new_col)
      cmap.name = f"{self.name}[{start:.2f}({span:+.2f})]"
      return cmap
  
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 7 for calling the ColorMap obj's underlying member method code with example usage: obj.getSubset(start, span) and returns: cmap