code: def _assert_boxcar_annot_similarity(raw, other):
      (
          onsets_raw,
          dur_raw,
          onsets_other,
          dur_other,
      ) = _annot_to_onset_dur(raw, other)
  
      n_events = len(onsets_raw)
      onsets_samp_raw = raw.time_as_index(onsets_raw)
      offsets_samp_raw = raw.time_as_index(onsets_raw + dur_raw)
      assert_allclose(
          raw.get_data("stim")[0, onsets_samp_raw - 2], [0] * n_events
      )
      assert_allclose(
          raw.get_data("stim")[0, onsets_samp_raw + 2], [1] * n_events
      )
      assert_allclose(
          raw.get_data("stim")[0, offsets_samp_raw - 2], [1] * n_events
      )
      assert_allclose(
          raw.get_data("stim")[0, offsets_samp_raw + 2], [0] * n_events
      )
      onsets_samp_other = other.time_as_index(onsets_other)
      offsets_samp_other = other.time_as_index(onsets_other + dur_other)
      assert_allclose(
          other.get_data("stim")[0, onsets_samp_other - 2],
          [0] * n_events,
      )
      assert_allclose(
          other.get_data("stim")[0, onsets_samp_other + 2],
          [1] * n_events,
      )
      assert_allclose(
          other.get_data("stim")[0, offsets_samp_other - 2],
          [1] * n_events,
      )
      assert_allclose(
          other.get_data("stim")[0, offsets_samp_other + 2],
          [0] * n_events,
      )
  
file_path: mne-python/mne/preprocessing/tests/test_realign.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose
  from scipy.interpolate import interp1d
  from mne import Annotations, Epochs, create_info, find_events
  from mne.io import RawArray
  from mne.preprocessing import realign_raw
label_desc: Use image node_id 3 for calling a global function with example usage: _assert_boxcar_annot_similarity(raw, other) without return types