code: def test_interpolate_meg_ctf():
      """Test interpolation of MEG channels from CTF system."""
      thresh = 0.85
      tol = 0.05  # assert the new interpol correlates at least .05 "better"
      bad = "MLC22-2622"  # select a good channel to test the interpolation
  
      raw = (
          read_raw_fif(raw_fname_ctf).crop(0, 1.0).load_data()
      )  # 3 secs
      raw.apply_gradient_compensation(3)
  
      # Show that we have to exclude ref_meg for interpolating CTF MEG-channels
      # (fixed in #5965):
      raw.info["bads"] = [bad]
      pick_bad = pick_channels(raw.info["ch_names"], raw.info["bads"])
      data_orig = raw[pick_bad, :][0]
      # mimic old behavior (the ref_meg-arg in _interpolate_bads_meg only serves
      # this purpose):
      data_interp_refmeg = _this_interpol(raw, ref_meg=True)[
          pick_bad, :
      ][0]
      # new:
      data_interp_no_refmeg = _this_interpol(raw, ref_meg=False)[
          pick_bad, :
      ][0]
  
      R = dict()
      R["no_refmeg"] = np.corrcoef(data_orig, data_interp_no_refmeg)[
          0, 1
      ]
      R["with_refmeg"] = np.corrcoef(data_orig, data_interp_refmeg)[
          0, 1
      ]
  
      print("Corrcoef of interpolated with original channel: ", R)
      assert R["no_refmeg"] > R["with_refmeg"] + tol
      assert R["no_refmeg"] > thresh
  
imports: from itertools import compress
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from mne import Epochs, pick_channels, pick_types, read_events
  from mne._fiff.constants import FIFF
  from mne._fiff.proj import _has_eeg_average_ref_proj
  from mne.channels import make_dig_montage
  from mne.channels.interpolation import _make_interpolation_matrix
  from mne.datasets import testing
  from mne.io import RawArray, read_raw_ctf, read_raw_fif, read_raw_nirx
  from mne.preprocessing.nirs import beer_lambert_law, optical_density, scalp_coupling_index
  from mne.utils import _record_warnings
label_desc: Use image node_id 5 for calling a global function with example usage: test_interpolate_meg_ctf() without return types