code: def _check_cola(win, nperseg, step, window_name, tol=1e-10):
      """Check whether the Constant OverLap Add (COLA) constraint is met."""
      # adapted from SciPy
      binsums = np.sum(
          [
              win[ii * step : (ii + 1) * step]
              for ii in range(nperseg // step)
          ],
          axis=0,
      )
      if nperseg % step != 0:
          binsums[: nperseg % step] += win[-(nperseg % step) :]
      const = np.median(binsums)
      deviation = np.max(np.abs(binsums - const))
      if deviation > tol:
          raise ValueError(
              "segment length %d with step %d for %s window "
              "type does not provide a constant output "
              "(%g%% deviation)"
              % (nperseg, step, window_name, 100 * deviation / const)
          )
      return const
  
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 2 for calling a global function with example usage: _check_cola(win, nperseg, step, window_name, tol) and returns: const