code: def test_neuralynx():
      """Test basic reading."""
      from neo.io import NeuralynxIO
  
      excluded_ncs_files = [
          "LAHCu1.ncs",
          "LAHC1_3_gaps.ncs",
          "LAHC2_3_gaps.ncs",
      ]
  
      # ==== MNE-Python ==== #
      fname_patterns = ["*u*.ncs", "*3_gaps.ncs"]
      raw = read_raw_neuralynx(
          fname=testing_path,
          preload=True,
          exclude_fname_patterns=fname_patterns,
      )
  
      # test that channel selection worked
      assert (
          raw.ch_names == expected_chan_names
      ), "labels in raw.ch_names don't match expected channel names"
  
      mne_y, mne_t = raw.get_data(return_times=True)  # in V
  
      # ==== NeuralynxIO ==== #
      nlx_reader = NeuralynxIO(
          dirname=testing_path, exclude_filename=excluded_ncs_files
      )
      bl = nlx_reader.read(
          lazy=False
      )  # read a single block which contains the data split in segments
  
      # concatenate all signals and times from all segments (== total recording)
      nlx_y = np.concatenate(
          [
              sig.magnitude
              for seg in bl[0].segments
              for sig in seg.analogsignals
          ]
      ).T
      nlx_y *= 1e-6  # convert from uV to V
  
      nlx_t = np.concatenate(
          [
              sig.times.magnitude
              for seg in bl[0].segments
              for sig in seg.analogsignals
          ]
      ).T
      nlx_t = np.round(nlx_t, 3)  # round to millisecond precision
  
      nlx_ch_names = [
          ch[0] for ch in nlx_reader.header["signal_channels"]
      ]
  
      # ===== Nlx2MatCSC.m ===== #
      matchans = [
          "LAHC1.mat",
          "LAHC2.mat",
          "LAHC3.mat",
          "xAIR1.mat",
          "xEKG1.mat",
      ]
  
      # (n_chan, n_samples) array, in V
      mat_y = np.stack(
          [
              _read_nlx_mat_chan(os.path.join(testing_path, ch))
              for ch in matchans
          ]
      )
  
      # ===== Check sample values across MNE-Python, NeuralynxIO and MATLAB ===== #
      assert nlx_ch_names == raw.ch_names  # check channel names
  
      assert_allclose(
          mne_y,
          nlx_y,
          rtol=1e-6,
          err_msg="MNE and NeuralynxIO not all close",
      )  # data
      assert_allclose(
          mne_y,
          mat_y,
          rtol=1e-6,
          err_msg="MNE and Nlx2MatCSC.m not all close",
      )  # data
  
      _test_raw_reader(
          read_raw_neuralynx,
          fname=testing_path,
          exclude_fname_patterns=fname_patterns,
      )
  
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 4 for calling a global function with example usage: test_neuralynx() without return types