code: def test_annotation_omit(first_samp):
      """Test raw.get_data with annotations."""
      data = np.concatenate(
          [np.ones((1, 1000)), 2 * np.ones((1, 1000))], -1
      )
      info = create_info(1, 1000.0, "eeg")
      raw = RawArray(data, info, first_samp=first_samp)
      raw.set_annotations(Annotations([0.5], [1], ["bad"]))
      expected = raw[0][0]
      assert_allclose(raw.get_data(reject_by_annotation=None), expected)
      # nan
      expected[0, 500:1500] = np.nan
      assert_allclose(
          raw.get_data(reject_by_annotation="nan"), expected
      )
      got = np.concatenate(
          [
              raw.get_data(
                  start=start, stop=stop, reject_by_annotation="nan"
              )
              for start, stop in ((0, 1000), (1000, 2000))
          ],
          -1,
      )
      assert_allclose(got, expected)
      # omit
      expected = expected[:, np.isfinite(expected[0])]
      assert_allclose(
          raw.get_data(reject_by_annotation="omit"), expected
      )
      got = np.concatenate(
          [
              raw.get_data(
                  start=start, stop=stop, reject_by_annotation="omit"
              )
              for start, stop in ((0, 1000), (1000, 2000))
          ],
          -1,
      )
      assert_allclose(got, expected)
      pytest.raises(
          ValueError, raw.get_data, reject_by_annotation="foo"
      )
  
imports: import sys
  from collections import OrderedDict
  from datetime import datetime, timedelta, timezone
  from itertools import repeat
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from pytest import approx
  import mne
  from mne import Annotations, Epochs, annotations_from_events, count_annotations, create_info, events_from_annotations, read_annotations
  from mne.annotations import _handle_meas_date, _read_annotations_txt_parse_header, _sync_onset
  from mne.datasets import testing
  from mne.io import RawArray, concatenate_raws, read_raw_fif
  from mne.utils import _dt_to_stamp, _raw_annot, _record_warnings, _stamp_to_dt, assert_and_remove_boundary_annot, catch_logging, check_version
label_desc: Use image node_id 13 for calling a global function with example usage: test_annotation_omit(first_samp) without return types