code: def test_explicit_bads_pick():
      """Test when bads channels are explicitly passed + default picks=None."""
      raw = read_raw_fif(raw_fname).crop(0, 5).load_data()
      raw.pick(picks=["eeg", "meg", "ref_meg"])
  
      # Covariance
      # Default picks=None
      raw.info["bads"] = list()
      noise_cov_1 = compute_raw_covariance(raw, picks=None)
      rank = compute_rank(noise_cov_1, info=raw.info)
      assert rank == dict(meg=303, eeg=60)
      assert raw.info["bads"] == []
  
      raw.info["bads"] = ["EEG 002", "EEG 012", "EEG 015", "MEG 0122"]
      noise_cov = compute_raw_covariance(raw, picks=None)
      rank = compute_rank(noise_cov, info=raw.info)
      assert rank == dict(meg=302, eeg=57)
      assert raw.info["bads"] == [
          "EEG 002",
          "EEG 012",
          "EEG 015",
          "MEG 0122",
      ]
  
      # Explicit picks
      picks = pick_types(raw.info, meg=True, eeg=True, exclude=[])
      noise_cov_2 = compute_raw_covariance(raw, picks=picks)
      rank = compute_rank(noise_cov_2, info=raw.info)
      assert rank == dict(meg=303, eeg=60)
      assert raw.info["bads"] == [
          "EEG 002",
          "EEG 012",
          "EEG 015",
          "MEG 0122",
      ]
  
      assert_array_equal(noise_cov_1["data"], noise_cov_2["data"])
      assert noise_cov_1["names"] == noise_cov_2["names"]
  
      # Raw
      raw.info["bads"] = list()
      rank = compute_rank(raw)
      assert rank == dict(meg=303, eeg=60)
  
      raw.info["bads"] = ["EEG 002", "EEG 012", "EEG 015", "MEG 0122"]
      rank = compute_rank(raw)
      assert rank == dict(meg=302, eeg=57)
  
file_path: mne-python/mne/tests/test_rank.py
imports: import itertools
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from mne import compute_raw_covariance, make_fixed_length_epochs, pick_info, pick_types, read_cov, read_evokeds
  from mne._fiff.pick import _picks_by_type
  from mne._fiff.proj import _has_eeg_average_ref_proj
  from mne.cov import prepare_noise_cov
  from mne.datasets import testing
  from mne.io import read_raw_fif
  from mne.proj import compute_proj_raw
  from mne.rank import _compute_rank_int, _estimate_rank_raw, _get_rank_sss, compute_rank, estimate_rank
label_desc: Use image node_id 6 for calling a global function with example usage: test_explicit_bads_pick() without return types