code: def _otp(data, picks_good, picks_bad):
      """Perform OTP on one segment of data."""
      if not np.isfinite(data).all():
          raise RuntimeError(
              "non-finite data (inf or nan) found in raw " "instance"
          )
      # demean our data
      data_means = np.mean(data, axis=-1, keepdims=True)
      data -= data_means
      # make a copy
      data_good = data[picks_good]
      # scale the copy that will be used to form the temporal basis vectors
      # so that _orth_svdvals thresholding should work properly with
      # different channel types (e.g., M-EEG)
      norms = _normalize_vectors(data_good)
      cov = np.dot(data_good, data_good.T)
      if len(picks_bad) > 0:
          full_basis = _svd_cov(cov, data_good)[2]
      for mi, pick in enumerate(picks_good):
          # operate on original data
          idx = list(range(mi)) + list(range(mi + 1, len(data_good)))
          # Equivalent: svd(data[idx], full_matrices=False)[2]
          t_basis = _svd_cov(cov[np.ix_(idx, idx)], data_good[idx])[2]
          x = np.dot(np.dot(data_good[mi], t_basis.T), t_basis)
          x *= norms[mi]
          x += data_means[pick]
          data[pick] = x
      for pick in picks_bad:
          data[pick] = np.dot(
              np.dot(data[pick], full_basis.T), full_basis
          )
          data[pick] += data_means[pick]
      return [data]
  
file_path: mne-python/mne/preprocessing/otp.py
imports: from functools import partial
  import numpy
  from .._fiff.pick import _picks_to_idx
  from .._ola import _COLA, _Storer
  from ..surface import _normalize_vectors
  from ..utils import logger, verbose
label_desc: Use image node_id 3 for calling a global function with example usage: _otp(data, picks_good, picks_bad) and returns: list