class_docstr: Interpolate between two points.
  
  Parameters
  ----------
  control_points : array, shape (n_changes,)
      The control points (indices) to use.
  values : callable | array, shape (n_changes, ...)
      Callable that takes the control point and returns a list of
      arrays that must be interpolated.
  interp : str
      Can be 'zero', 'linear', 'hann', or 'cos2' (same as hann).
  
  Notes
  -----
  This will process data using overlapping windows of potentially
  different sizes to achieve a constant output value using different
  2-point interpolation schemes. For example, for linear interpolation,
  and window sizes of 6 and 17, this would look like::
  
      1 _     _
        |\   / '-.           .-'
        | \ /     '-.     .-'
        |  x         |-.-|
        | / \     .-'     '-.
        |/   \_.-'           '-.
      0 +----|----|----|----|---
        0    5   10   15   20   25
code: def __init__(self, control_points, values, interp="hann"):
      # set up interpolation
      self.control_points = np.array(control_points, int).ravel()
      if not np.array_equal(
          np.unique(self.control_points), self.control_points
      ):
          raise ValueError("Control points must be sorted and unique")
      if len(self.control_points) == 0:
          raise ValueError("Must be at least one control point")
      if not (self.control_points >= 0).all():
          raise ValueError(
              f"All control points must be positive (got {self.control_points[:3]})"
          )
      if isinstance(values, np.ndarray):
          values = [values]
      if isinstance(values, (list, tuple)):
          for v in values:
              if not (v is None or isinstance(v, np.ndarray)):
                  raise TypeError(
                      'All entries in "values" must be ndarray or None, got '
                      f"{type(v)}"
                  )
              if v is not None and v.shape[0] != len(
                  self.control_points
              ):
                  raise ValueError(
                      "Values, if provided, must be the same length as the number of "
                      f"control points ({len(self.control_points)}), got {v.shape[0]}"
                  )
          use_values = values
  
          def val(pt):
              idx = np.where(control_points == pt)[0][0]
              return [
                  v[idx] if v is not None else None for v in use_values
              ]
  
          values = val
      self.values = values
      self.n_last = None
      self._position = 0  # start at zero
      self._left_idx = 0
      self._left = self._right = self._use_interp = None
      known_types = ("cos2", "linear", "zero", "hann")
      if interp not in known_types:
          raise ValueError(
              f'interp must be one of {known_types}, got "{interp}"'
          )
      self._interp = interp
  
file_path: mne-python/mne/_ola.py
imports: import numpy
  from scipy.signal import get_window
  from .utils import _ensure_int, logger, verbose
label_desc: Use image node_id 1 to create a new _Interp2 object  with example: obj = _Interp2(control_points, values, interp)