code: def test_boxy_digaux(fname):
      """Test reading BOXY files and generating annotations from digaux."""
      srate = 79.4722
      raw = read_raw_boxy(fname, verbose=True)
  
      # Grab our different data types.
      picks_dc = pick_types(raw.info, fnirs="fnirs_cw_amplitude")
      picks_ac = pick_types(raw.info, fnirs="fnirs_fd_ac_amplitude")
      picks_ph = pick_types(raw.info, fnirs="fnirs_fd_phase")
      assert_array_equal(picks_dc, np.arange(0, 8) * 3 + 0)
      assert_array_equal(picks_ac, np.arange(0, 8) * 3 + 1)
      assert_array_equal(picks_ph, np.arange(0, 8) * 3 + 2)
  
      # Check that our event order matches what we expect.
      event_list = ["1.0", "2.0", "3.0", "4.0", "5.0"]
      assert_array_equal(raw.annotations.description, event_list)
  
      # Check that our event timings are what we expect.
      event_onset = [
          i_time * (1.0 / srate) for i_time in [105, 185, 265, 344, 424]
      ]
      assert_allclose(raw.annotations.onset, event_onset, atol=1e-6)
  
      # Now let's compare parsed and unparsed events to p_pod loaded digaux.
      # Load our p_pod data.
      ppod_data = spio.loadmat(p_pod_0_84)
      ppod_digaux = np.transpose(ppod_data["digaux"])[0]
  
      # Now let's get our triggers from the p_pod digaux.
      # We only want the first instance of each trigger.
      prev_mrk = 0
      mrk_idx = list()
      duration = list()
      tmp_dur = 0
      for i_num, i_mrk in enumerate(ppod_digaux):
          if i_mrk != 0 and i_mrk != prev_mrk:
              mrk_idx.append(i_num)
          if i_mrk != 0 and i_mrk == prev_mrk:
              tmp_dur += 1
          if i_mrk == 0 and i_mrk != prev_mrk:
              duration.append((tmp_dur + 1) * (1.0 / srate))
              tmp_dur = 0
          prev_mrk = i_mrk
      onset = np.asarray([i_mrk * (1.0 / srate) for i_mrk in mrk_idx])
      description = np.asarray(
          [str(float(i_mrk)) for i_mrk in ppod_digaux[mrk_idx]]
      )
      assert_array_equal(raw.annotations.description, description)
      assert_allclose(raw.annotations.onset, onset, atol=1e-6)
  
file_path: mne-python/mne/io/boxy/tests/test_boxy.py
imports: import numpy
  import pytest
  import scipy.io
  from numpy.testing import assert_allclose, assert_array_equal, assert_array_less
  from mne import pick_types
  from mne.datasets import testing
  from mne.io import read_raw_boxy
  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_boxy_digaux(fname) without return types