code: def test_fnirs_channel_naming_and_order_readers(fname):
      """Ensure fNIRS channel checking on standard readers."""
      # fNIRS data requires specific channel naming and ordering.
  
      # All standard readers should pass tests
      raw = read_raw_nirx(fname)
      freqs = np.unique(_channel_frequencies(raw.info))
      assert_array_equal(freqs, [760, 850])
      chroma = np.unique(_channel_chromophore(raw.info))
      assert len(chroma) == 0
  
      picks = _check_channels_ordered(raw.info, freqs)
      assert len(picks) == len(raw.ch_names)  # as all fNIRS only data
  
      # Check that dropped channels are detected
      # For each source detector pair there must be two channels,
      # removing one should throw an error.
      raw_dropped = raw.copy().drop_channels(raw.ch_names[4])
      with pytest.raises(ValueError, match="not ordered correctly"):
          _check_channels_ordered(raw_dropped.info, freqs)
  
      # The ordering must be increasing for the pairs, if provided
      raw_names_reversed = raw.copy().ch_names
      raw_names_reversed.reverse()
      raw_reversed = raw.copy().pick(raw_names_reversed)
      with pytest.raises(ValueError, match="The frequencies.*sorted.*"):
          _check_channels_ordered(raw_reversed.info, [850, 760])
      # So if we flip the second argument it should pass again
      picks = _check_channels_ordered(raw_reversed.info, freqs)
      got_first = set(
          raw_reversed.ch_names[pick].split()[1] for pick in picks[::2]
      )
      assert got_first == {"760"}
      got_second = set(
          raw_reversed.ch_names[pick].split()[1] for pick in picks[1::2]
      )
      assert got_second == {"850"}
  
      # Check on OD data
      raw = optical_density(raw)
      freqs = np.unique(_channel_frequencies(raw.info))
      assert_array_equal(freqs, [760, 850])
      chroma = np.unique(_channel_chromophore(raw.info))
      assert len(chroma) == 0
      picks = _check_channels_ordered(raw.info, freqs)
      assert len(picks) == len(raw.ch_names)  # as all fNIRS only data
  
      # Check on haemoglobin data
      raw = beer_lambert_law(raw)
      freqs = np.unique(_channel_frequencies(raw.info))
      assert len(freqs) == 0
      assert len(_channel_chromophore(raw.info)) == len(raw.ch_names)
      chroma = np.unique(_channel_chromophore(raw.info))
      assert_array_equal(chroma, ["hbo", "hbr"])
      picks = _check_channels_ordered(raw.info, chroma)
      assert len(picks) == len(raw.ch_names)
      with pytest.raises(ValueError, match="chromophore in info"):
          _check_channels_ordered(raw.info, ["hbr", "hbo"])
  
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from mne import create_info
  from mne._fiff.constants import FIFF
  from mne._fiff.pick import _picks_to_idx
  from mne.datasets import testing
  from mne.datasets.testing import data_path
  from mne.io import RawArray, read_raw_nirx
  from mne.preprocessing.nirs import _channel_chromophore, _channel_frequencies, _check_channels_ordered, _fnirs_optode_names, _fnirs_spread_bads, _optode_position, _validate_nirs_info, beer_lambert_law, optical_density, scalp_coupling_index, tddr
label_desc: Use image node_id 5 for calling a global function with example usage: test_fnirs_channel_naming_and_order_readers(fname) without return types