code: def test_compute_proj_eog(average, short_raw):
      """Test computation of EOG SSP projectors."""
      raw = short_raw
  
      n_projs_init = len(raw.info["projs"])
      with pytest.warns(RuntimeWarning, match="Attenuation"):
          projs, events = compute_proj_eog(
              raw,
              n_mag=2,
              n_grad=2,
              n_eeg=2,
              bads=["MEG 2443"],
              average=average,
              avg_ref=True,
              no_proj=False,
              l_freq=None,
              h_freq=None,
              reject=None,
              tmax=dur_use,
              filter_length=1000,
          )
      assert len(projs) == (7 + n_projs_init)
      assert (
          np.abs(events.shape[0] - np.sum(np.less(eog_times, dur_use)))
          <= 1
      )
      ssp_eog = [
          proj for proj in projs if proj["desc"].startswith("EOG")
      ]
      # check that the first principal component have a certain minimum
      ssp_eog = [proj for proj in ssp_eog if "PCA-01" in proj["desc"]]
      thresh_eeg, thresh_axial, thresh_planar = 0.9, 0.3, 0.1
      for proj in ssp_eog:
          if "planar" in proj["desc"]:
              assert proj["explained_var"] > thresh_planar
          elif "axial" in proj["desc"]:
              assert proj["explained_var"] > thresh_axial
          elif "eeg" in proj["desc"]:
              assert proj["explained_var"] > thresh_eeg
      # XXX: better tests
  
      with pytest.warns(RuntimeWarning, match="longer"):
          projs, events = compute_proj_eog(
              raw,
              n_mag=2,
              n_grad=2,
              n_eeg=2,
              average=average,
              bads=[],
              avg_ref=True,
              no_proj=False,
              l_freq=None,
              h_freq=None,
              tmax=dur_use,
          )
      assert projs == []
  
      raw._data[raw.ch_names.index("EOG 061"), :] = 1.0
      with pytest.warns(
          RuntimeWarning, match="filter.*longer than the signal"
      ):
          projs, events = compute_proj_eog(
              raw=raw, tmax=dur_use, ch_name="EOG 061"
          )
  
file_path: mne-python/mne/preprocessing/tests/test_ssp.py
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from mne import pick_types
  from mne._fiff.proj import activate_proj, make_projector
  from mne.datasets import testing
  from mne.io import read_raw_ctf, read_raw_fif
  from mne.preprocessing.ssp import compute_proj_ecg, compute_proj_eog
label_desc: Use image node_id 3 for calling a global function with example usage: test_compute_proj_eog(average, short_raw) without return types