code: def test_pick_refs():
      """Test picking of reference sensors."""
      infos = list()
      # KIT
      kit_dir = io_dir / "kit" / "tests" / "data"
      sqd_path = kit_dir / "test.sqd"
      mrk_path = kit_dir / "test_mrk.sqd"
      elp_path = kit_dir / "test_elp.txt"
      hsp_path = kit_dir / "test_hsp.txt"
      raw_kit = read_raw_kit(
          sqd_path, str(mrk_path), str(elp_path), str(hsp_path)
      )
      infos.append(raw_kit.info)
      # BTi
      bti_dir = io_dir / "bti" / "tests" / "data"
      bti_pdf = bti_dir / "test_pdf_linux"
      bti_config = bti_dir / "test_config_linux"
      bti_hs = bti_dir / "test_hs_linux"
      raw_bti = read_raw_bti(bti_pdf, bti_config, bti_hs, preload=False)
      infos.append(raw_bti.info)
      # CTF
      fname_ctf_raw = (
          io_dir / "tests" / "data" / "test_ctf_comp_raw.fif"
      )
      raw_ctf = read_raw_fif(fname_ctf_raw)
      raw_ctf.apply_gradient_compensation(2)
      for info in infos:
          info["bads"] = []
          _assert_channel_types(info)
          with pytest.raises(
              ValueError, match="'planar2'] or bool, not foo"
          ):
              pick_types(info, meg="foo")
          with pytest.raises(
              ValueError, match="'planar2', 'auto'] or bool,"
          ):
              pick_types(info, ref_meg="foo")
          picks_meg_ref = pick_types(info, meg=True, ref_meg=True)
          picks_meg = pick_types(info, meg=True, ref_meg=False)
          picks_ref = pick_types(info, meg=False, ref_meg=True)
          assert_array_equal(
              picks_meg_ref,
              np.sort(np.concatenate([picks_meg, picks_ref])),
          )
          picks_grad = pick_types(info, meg="grad", ref_meg=False)
          picks_ref_grad = pick_types(info, meg=False, ref_meg="grad")
          picks_meg_ref_grad = pick_types(
              info, meg="grad", ref_meg="grad"
          )
          assert_array_equal(
              picks_meg_ref_grad,
              np.sort(np.concatenate([picks_grad, picks_ref_grad])),
          )
          picks_mag = pick_types(info, meg="mag", ref_meg=False)
          picks_ref_mag = pick_types(info, meg=False, ref_meg="mag")
          picks_meg_ref_mag = pick_types(info, meg="mag", ref_meg="mag")
          assert_array_equal(
              picks_meg_ref_mag,
              np.sort(np.concatenate([picks_mag, picks_ref_mag])),
          )
          assert_array_equal(
              picks_meg,
              np.sort(np.concatenate([picks_mag, picks_grad])),
          )
          assert_array_equal(
              picks_ref,
              np.sort(np.concatenate([picks_ref_mag, picks_ref_grad])),
          )
          assert_array_equal(
              picks_meg_ref,
              np.sort(
                  np.concatenate(
                      [
                          picks_grad,
                          picks_mag,
                          picks_ref_grad,
                          picks_ref_mag,
                      ]
                  )
              ),
          )
  
          for pick in (
              picks_meg_ref,
              picks_meg,
              picks_ref,
              picks_grad,
              picks_ref_grad,
              picks_meg_ref_grad,
              picks_mag,
              picks_ref_mag,
              picks_meg_ref_mag,
          ):
              if len(pick) > 0:
                  pick_info(info, pick)
  
      # test CTF expected failures directly
      info = raw_ctf.info
      info["bads"] = []
      picks_meg_ref = pick_types(info, meg=True, ref_meg=True)
      picks_meg = pick_types(info, meg=True, ref_meg=False)
      picks_ref = pick_types(info, meg=False, ref_meg=True)
      picks_mag = pick_types(info, meg="mag", ref_meg=False)
      picks_ref_mag = pick_types(info, meg=False, ref_meg="mag")
      picks_meg_ref_mag = pick_types(info, meg="mag", ref_meg="mag")
      for pick in (
          picks_meg_ref,
          picks_ref,
          picks_ref_mag,
          picks_meg_ref_mag,
      ):
          if len(pick) > 0:
              pick_info(info, pick)
  
      for pick in (picks_meg, picks_mag):
          if len(pick) > 0:
              with catch_logging() as log:
                  pick_info(info, pick, verbose=True)
              assert (
                  "Removing {} compensators".format(len(info["comps"]))
                  in log.getvalue()
              )
      picks_ref_grad = pick_types(info, meg=False, ref_meg="grad")
      assert set(picks_ref_mag) == set(picks_ref)
      assert len(picks_ref_grad) == 0
      all_meg = np.arange(3, 306)
      assert_array_equal(
          np.concatenate([picks_ref, picks_meg]), all_meg
      )
      assert_array_equal(picks_meg_ref_mag, all_meg)
  
imports: from copy import deepcopy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from mne import Epochs, channel_indices_by_type, channel_type, create_info, make_ad_hoc_cov, pick_channels, pick_channels_cov, pick_channels_regexp, pick_info, pick_types, pick_types_forward, read_forward_solution, rename_channels
  from mne._fiff.constants import FIFF
  from mne._fiff.pick import _DATA_CH_TYPES_SPLIT, _contains_ch_type, _picks_by_type, _picks_to_idx, get_channel_type_constants
  from mne.channels import make_standard_montage
  from mne.datasets import testing
  from mne.io import RawArray, read_info, read_raw_bti, read_raw_fif, read_raw_kit
  from mne.preprocessing import compute_current_source_density
  from mne.utils import assert_object_equal, catch_logging
label_desc: Use image node_id 4 for calling a global function with example usage: test_pick_refs() without return types