code: def test_low_rank_cov(raw_epochs_events):
      """Test additional properties of low rank computations."""
      pytest.importorskip("sklearn")
      raw, epochs, events = raw_epochs_events
      sss_proj_rank = 139  # 80 MEG + 60 EEG - 1 proj
      n_ch = 366
      proj_rank = 365  # one EEG proj
      with pytest.warns(RuntimeWarning, match="Too few samples"):
          emp_cov = compute_covariance(epochs)
      # Test equivalence with mne.cov.regularize subspace
      with pytest.raises(ValueError, match="are dependent.*must equal"):
          regularize(emp_cov, epochs.info, rank=None, mag=0.1, grad=0.2)
      assert _cov_rank(emp_cov, epochs.info) == sss_proj_rank
      reg_cov = regularize(emp_cov, epochs.info, proj=True, rank="full")
      assert _cov_rank(reg_cov, epochs.info) == proj_rank
      with pytest.warns(
          RuntimeWarning, match="exceeds the theoretical"
      ):
          _compute_rank_int(reg_cov, info=epochs.info)
      del reg_cov
      with catch_logging() as log:
          reg_r_cov = regularize(
              emp_cov, epochs.info, proj=True, rank=None, verbose=True
          )
      log = log.getvalue()
      assert "jointly" in log
      assert _cov_rank(reg_r_cov, epochs.info) == sss_proj_rank
      reg_r_only_cov = regularize(
          emp_cov, epochs.info, proj=False, rank=None
      )
      assert _cov_rank(reg_r_only_cov, epochs.info) == sss_proj_rank
      assert_allclose(reg_r_only_cov["data"], reg_r_cov["data"])
      del reg_r_only_cov, reg_r_cov
  
      # test that rank=306 is same as rank='full'
      epochs_meg = epochs.copy().pick("meg")
      assert len(epochs_meg.ch_names) == 306
      with epochs_meg.info._unlock():
          epochs_meg.info.update(bads=[], projs=[])
      cov_full = compute_covariance(
          epochs_meg, method="oas", rank="full", verbose="error"
      )
      assert _cov_rank(cov_full, epochs_meg.info) == 306
      with pytest.warns(RuntimeWarning, match="few samples"):
          cov_dict = compute_covariance(
              epochs_meg, method="oas", rank=dict(meg=306)
          )
      assert _cov_rank(cov_dict, epochs_meg.info) == 306
      assert_allclose(cov_full["data"], cov_dict["data"])
      cov_dict = compute_covariance(
          epochs_meg, method="oas", rank=dict(meg=306), verbose="error"
      )
      assert _cov_rank(cov_dict, epochs_meg.info) == 306
      assert_allclose(cov_full["data"], cov_dict["data"])
  
      # Work with just EEG data to simplify projection / rank reduction
      raw = raw.copy().pick("eeg")
      n_proj = 2
      raw.add_proj(compute_proj_raw(raw, n_eeg=n_proj))
      n_ch = len(raw.ch_names)
      rank = n_ch - n_proj - 1  # plus avg proj
      assert len(raw.info["projs"]) == 3
      epochs = Epochs(raw, events, tmin=-0.2, tmax=0, preload=True)
      assert len(raw.ch_names) == n_ch
      emp_cov = compute_covariance(epochs, rank="full", verbose="error")
      assert _cov_rank(emp_cov, epochs.info) == rank
      reg_cov = regularize(emp_cov, epochs.info, proj=True, rank="full")
      assert _cov_rank(reg_cov, epochs.info) == rank
      reg_r_cov = regularize(
          emp_cov, epochs.info, proj=False, rank=None
      )
      assert _cov_rank(reg_r_cov, epochs.info) == rank
      dia_cov = compute_covariance(
          epochs, rank=None, method="diagonal_fixed", verbose="error"
      )
      assert _cov_rank(dia_cov, epochs.info) == rank
      assert_allclose(dia_cov["data"], reg_cov["data"])
      epochs.pick(epochs.ch_names[:103])
      # degenerate
      with pytest.raises(
          ValueError, match='can.*only be used with rank="full"'
      ):
          compute_covariance(epochs, rank=None, method="pca")
      with pytest.raises(
          ValueError, match='can.*only be used with rank="full"'
      ):
          compute_covariance(
              epochs, rank=None, method="factor_analysis"
          )
  
imports: import itertools
  import sys
  from inspect import signature
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from mne import Epochs, compute_covariance, compute_proj_raw, compute_rank, compute_raw_covariance, create_info, find_events, make_ad_hoc_cov, make_fixed_length_events, merge_events, pick_channels_cov, pick_info, pick_types, read_cov, read_evokeds, write_cov
  from mne._fiff.pick import _DATA_CH_TYPES_SPLIT
  from mne.channels import equalize_channels
  from mne.cov import _auto_low_rank_model, _regularized_covariance, compute_whitener, prepare_noise_cov, regularize, whiten_evoked
  from mne.datasets import testing
  from mne.fixes import _safe_svd
  from mne.io import RawArray, read_info, read_raw_ctf, read_raw_fif
  from mne.preprocessing import maxwell_filter
  from mne.rank import _compute_rank_int
  from mne.utils import _record_warnings, assert_snr, catch_logging
label_desc: Use image node_id 20 for calling a global function with example usage: test_low_rank_cov(raw_epochs_events) without return types