code: def test_raw_events():
      """Test creating stim channel from raw SQD file."""
  
      def evts(a, b, c, d, e, f=None):
          out = [[269, a, b], [281, b, c], [1552, c, d], [1564, d, e]]
          if f is not None:
              out.append([2000, e, f])
          return out
  
      raw = read_raw_kit(sqd_path)
      assert_array_equal(
          find_events(raw, output="step", consecutive=True),
          evts(255, 254, 255, 254, 255, 0),
      )
  
      raw = read_raw_kit(sqd_path, slope="+")
      assert_array_equal(
          find_events(raw, output="step", consecutive=True),
          evts(0, 1, 0, 1, 0),
      )
  
      raw = read_raw_kit(sqd_path, stim="<", slope="+")
      assert_array_equal(
          find_events(raw, output="step", consecutive=True),
          evts(0, 128, 0, 128, 0),
      )
  
      raw = read_raw_kit(
          sqd_path, stim="<", slope="+", stim_code="channel"
      )
      assert_array_equal(
          find_events(raw, output="step", consecutive=True),
          evts(0, 160, 0, 160, 0),
      )
  
      raw = read_raw_kit(
          sqd_path, stim=range(160, 162), slope="+", stim_code="channel"
      )
      assert_array_equal(
          find_events(raw, output="step", consecutive=True),
          evts(0, 160, 0, 160, 0),
      )
  
imports: from pathlib import Path
  import numpy
  import pytest
  import scipy.io
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import linalg
  import mne
  from mne import Epochs, find_events, pick_types, read_events
  from mne._fiff.constants import FIFF
  from mne.datasets.testing import requires_testing_data
  from mne.io import read_epochs_kit, read_raw_fif, read_raw_kit
  from mne.io.kit.constants import KIT
  from mne.io.kit.coreg import read_sns
  from mne.io.kit.kit import get_kit_info
  from mne.io.tests.test_raw import _test_raw_reader
  from mne.surface import _get_ico_surface
  from mne.transforms import apply_trans
  from mne.utils import assert_dig_allclose
label_desc: Use image node_id 6 for calling a global function with example usage: test_raw_events() and returns: out