code: def test_neuralynx_gaps():
      """Test gap detection."""
      # ignore files with no gaps
      ignored_ncs_files = [
          "LAHC1.ncs",
          "LAHC2.ncs",
          "LAHC3.ncs",
          "xAIR1.ncs",
          "xEKG1.ncs",
          "LAHCu1.ncs",
      ]
      raw = read_raw_neuralynx(
          fname=testing_path,
          preload=True,
          exclude_fname_patterns=ignored_ncs_files,
      )
      mne_y, _ = raw.get_data(return_times=True)  # in V
  
      # there should be 2 channels with 3 gaps (of 130 samples in total)
      n_expected_gaps = 3
      n_expected_missing_samples = 130
      assert (
          len(raw.annotations) == n_expected_gaps
      ), "Wrong number of gaps detected"
      assert (
          mne_y[0, :] == 0
      ).sum() == n_expected_missing_samples, (
          "Number of true and inferred missing samples differ"
      )
  
      # read in .mat files containing original gaps
      matchans = ["LAHC1_3_gaps.mat", "LAHC2_3_gaps.mat"]
  
      # (n_chan, n_samples) array, in V
      mat_y = np.stack(
          [
              _read_nlx_mat_chan_keep_gaps(
                  os.path.join(testing_path, ch)
              )
              for ch in matchans
          ]
      )
  
      # compare originally modified .ncs arrays with MNE-padded arrays
      # and test that we back-inserted 0's at the right places
      assert_allclose(
          mne_y,
          mat_y,
          rtol=1e-6,
          err_msg="MNE and Nlx2MatCSC.m not all close",
      )
  
      # test that channel selection works
      raw = read_raw_neuralynx(
          fname=testing_path,
          preload=False,
          exclude_fname_patterns=ignored_ncs_files,
      )
  
      raw.pick("LAHC2")
      assert raw.ch_names == ["LAHC2"]
      raw.load_data()
  
file_path: mne-python/mne/io/neuralynx/tests/test_neuralynx.py
imports: import os
  from ast import literal_eval
  import numpy
  import pytest
  from numpy.testing import assert_allclose
  from scipy.io import loadmat
  from mne.datasets.testing import data_path, requires_testing_data
  from mne.io import read_raw_neuralynx
  from mne.io.tests.test_raw import _test_raw_reader
label_desc: Use image node_id 5 for calling a global function with example usage: test_neuralynx_gaps() without return types