code: def _find_eog_events(
      eog,
      *,
      ch_names,
      event_id,
      l_freq,
      h_freq,
      sampling_rate,
      first_samp,
      filter_length="10s",
      tstart=0.0,
      thresh=None,
      verbose=None,
  ):
      """Find EOG events."""
      logger.info(
          "Filtering the data to remove DC offset to help "
          "distinguish blinks from saccades"
      )
  
      # filtering to remove dc offset so that we know which is blink and saccades
      # hardcode verbose=False to suppress filter param messages (since this
      # filter is not under user control)
      fmax = np.minimum(
          45, sampling_rate / 2.0 - 0.75
      )  # protect Nyquist
      filteog = np.array(
          [
              filter_data(
                  x,
                  sampling_rate,
                  2,
                  fmax,
                  None,
                  filter_length,
                  0.5,
                  0.5,
                  phase="zero-double",
                  fir_window="hann",
                  fir_design="firwin2",
                  verbose=False,
              )
              for x in eog
          ]
      )
      temp = np.sqrt(np.sum(filteog**2, axis=1))
      indexmax = np.argmax(temp)
      if (
          ch_names is not None
      ):  # it can be None if called from ica_find_eog_events
          logger.info(
              f"Selecting channel {ch_names[indexmax]} for blink detection"
          )
  
      # easier to detect peaks with filtering.
      filteog = filter_data(
          eog[indexmax],
          sampling_rate,
          l_freq,
          h_freq,
          None,
          filter_length,
          0.5,
          0.5,
          phase="zero-double",
          fir_window="hann",
          fir_design="firwin2",
      )
  
      # detecting eog blinks and generating event file
  
      logger.info(
          "Now detecting blinks and generating corresponding events"
      )
  
      temp = filteog - np.mean(filteog)
      n_samples_start = int(sampling_rate * tstart)
      if np.abs(np.max(temp)) > np.abs(np.min(temp)):
          eog_events, _ = peak_finder(
              filteog[n_samples_start:], thresh, extrema=1
          )
      else:
          eog_events, _ = peak_finder(
              filteog[n_samples_start:], thresh, extrema=-1
          )
  
      eog_events += n_samples_start
      n_events = len(eog_events)
      logger.info(f"Number of EOG events detected: {n_events}")
      eog_events = np.array(
          [
              eog_events + first_samp,
              np.zeros(n_events, int),
              event_id * np.ones(n_events, int),
          ]
      ).T
  
      return eog_events
  
file_path: mne-python/mne/preprocessing/eog.py
imports: import numpy
  from .._fiff.pick import pick_channels, pick_types
  from ..epochs import Epochs
  from ..filter import filter_data
  from ..utils import _pl, _validate_type, logger, verbose
  from ._peak_finder import peak_finder
label_desc: Use image node_id 2 for calling a global function with example usage: _find_eog_events(eog) and returns: eog_events