code: def test_compute_proj_explained_variance():
      """Test computation based on the explained variance."""
      raw = read_raw_fif(
          sample_path / "sample_audvis_trunc_raw.fif", preload=False
      )
      raw.crop(0, 5).load_data()
      raw.del_proj("all")
      with pytest.warns(RuntimeWarning, match="Too few samples"):
          projs = compute_proj_raw(
              raw, duration=None, n_grad=0.7, n_mag=0.9, n_eeg=0.8
          )
      for type_, n_vector_ in (
          ("planar", 0.7),
          ("axial", 0.9),
          ("eeg", 0.8),
      ):
          explained_var = [
              proj["explained_var"]
              for proj in projs
              if proj["desc"].split("-")[0] == type_
          ]
          assert n_vector_ <= sum(explained_var)
  
imports: import copy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_equal
  from scipy import linalg
  from mne import Epochs, compute_proj_epochs, compute_proj_evoked, compute_proj_raw, compute_raw_covariance, convert_forward_solution, create_info, pick_types, read_events, read_forward_solution, read_source_estimate, sensitivity_map
  from mne._fiff.proj import _EEG_AVREF_PICK_DICT, _needs_eeg_average_ref_proj, activate_proj, make_projector, setup_proj
  from mne.cov import compute_whitener, regularize
  from mne.datasets import testing
  from mne.io import RawArray, read_raw_fif
  from mne.preprocessing import maxwell_filter
  from mne.proj import _has_eeg_average_ref_proj, make_eeg_average_ref_proj, read_proj, write_proj
  from mne.rank import _compute_rank_int
  from mne.utils import _record_warnings
label_desc: Use image node_id 13 for calling a global function with example usage: test_compute_proj_explained_variance() without return types