code: def test_nirsport_v1_w_bad_sat(preload, meas_date):
      """Test NIRSport1 file with NaNs."""
      fname = nirsport1_w_fullsat
      raw = read_raw_nirx(fname, preload=preload)
      data = raw.get_data()
      assert not np.isnan(data).any()
      assert len(raw.annotations) == 5
      # annotated version and ignore should have same data but different annot
      raw_ignore = read_raw_nirx(
          fname, saturated="ignore", preload=preload
      )
      assert_allclose(raw_ignore.get_data(), data)
      assert len(raw_ignore.annotations) == 2
      assert not any(
          "NAN" in d for d in raw_ignore.annotations.description
      )
      # nan version should not have same data, but we can give it the same annot
      raw_nan = read_raw_nirx(fname, saturated="nan", preload=preload)
      data_nan = raw_nan.get_data()
      assert np.isnan(data_nan).any()
      assert not np.allclose(raw_nan.get_data(), data)
      raw_nan_annot = raw_ignore.copy()
      if meas_date is None:
          raw.set_meas_date(None)
          raw_nan.set_meas_date(None)
          raw_nan_annot.set_meas_date(None)
      nan_annots = annotate_nan(raw_nan)
      assert nan_annots.orig_time == raw_nan.info["meas_date"]
      raw_nan_annot.set_annotations(nan_annots)
      use_mask = np.where(
          raw.annotations.description == "BAD_SATURATED"
      )
      for key in ("onset", "duration"):
          a = getattr(raw_nan_annot.annotations, key)[
              ::2
          ]  # one ch in each
          b = getattr(raw.annotations, key)[use_mask]  # two chs in each
          assert_allclose(a, b)
  
imports: import datetime
  import os
  import shutil
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from mne import pick_types
  from mne._fiff.constants import FIFF
  from mne.datasets.testing import data_path, requires_testing_data
  from mne.io import read_raw_nirx
  from mne.io.tests.test_raw import _test_raw_reader
  from mne.preprocessing import annotate_nan
  from mne.preprocessing.nirs import _reorder_nirx, short_channels, source_detector_distances
  from mne.transforms import _get_trans, apply_trans
label_desc: Use image node_id 5 for calling a global function with example usage: test_nirsport_v1_w_bad_sat(preload, meas_date) without return types