code: def test_set_montage_artinis_basic():
      """Test that OctaMon and Brite23 montages are set properly."""
      # Test OctaMon montage
      montage_octamon = make_standard_montage("artinis-octamon")
      montage_brite23 = make_standard_montage("artinis-brite23")
      raw = _simulate_artinis_octamon()
      raw_od = optical_density(raw)
      old_info = raw.info.copy()
      old_info_od = raw_od.info.copy()
      raw.set_montage(montage_octamon)
      raw_od.set_montage(montage_octamon)
      raw_hb = beer_lambert_law(raw_od, ppf=6)  # montage needed for BLL
      # Check that the montage was actually modified
      assert_raises(
          AssertionError,
          assert_array_almost_equal,
          old_info["chs"][0]["loc"][:9],
          raw.info["chs"][0]["loc"][:9],
      )
      assert_raises(
          AssertionError,
          assert_array_almost_equal,
          old_info_od["chs"][0]["loc"][:9],
          raw_od.info["chs"][0]["loc"][:9],
      )
  
      # Check a known location
      assert_array_almost_equal(
          raw.info["chs"][0]["loc"][:3], [0.054243, 0.081884, 0.054544]
      )
      assert_array_almost_equal(
          raw.info["chs"][8]["loc"][:3], [-0.03013, 0.105097, 0.055894]
      )
      assert_array_almost_equal(
          raw.info["chs"][12]["loc"][:3],
          [-0.055681, 0.086566, 0.055858],
      )
      assert_array_almost_equal(
          raw_od.info["chs"][12]["loc"][:3],
          [-0.055681, 0.086566, 0.055858],
      )
      assert_array_almost_equal(
          raw_hb.info["chs"][12]["loc"][:3],
          [-0.055681, 0.086566, 0.055858],
      )
      # Check that locations are identical for a pair of channels (all elements
      # except the 10th which is the wavelength if not hbo and hbr type)
      assert_array_almost_equal(
          raw.info["chs"][0]["loc"][:9], raw.info["chs"][1]["loc"][:9]
      )
      assert_array_almost_equal(
          raw_od.info["chs"][0]["loc"][:9],
          raw_od.info["chs"][1]["loc"][:9],
      )
      assert_array_almost_equal(
          raw_hb.info["chs"][0]["loc"][:9],
          raw_hb.info["chs"][1]["loc"][:9],
      )
  
      # Test Brite23 montage
      raw = _simulate_artinis_brite23()
      old_info = raw.info.copy()
      raw.set_montage(montage_brite23)
      # Check that the montage was actually modified
      assert_raises(
          AssertionError,
          assert_array_almost_equal,
          old_info["chs"][0]["loc"][:9],
          raw.info["chs"][0]["loc"][:9],
      )
      # Check a known location
      assert_array_almost_equal(
          raw.info["chs"][0]["loc"][:3], [0.068931, 0.046201, 0.072055]
      )
      assert_array_almost_equal(
          raw.info["chs"][8]["loc"][:3], [0.055196, 0.082757, 0.052165]
      )
      assert_array_almost_equal(
          raw.info["chs"][12]["loc"][:3], [0.033592, 0.102607, 0.047423]
      )
      # Check that locations are identical for a pair of channels (all elements
      # except the 10th which is the wavelength if not hbo and hbr type)
      assert_array_almost_equal(
          raw.info["chs"][0]["loc"][:9], raw.info["chs"][1]["loc"][:9]
      )
  
      # Test channel variations
      raw_old = _simulate_artinis_brite23()
      # Raw missing some channels that are in the montage: pass
      raw = raw_old.copy()
      raw.pick(["S1_D1 hbo", "S1_D1 hbr"])
      raw.set_montage("artinis-brite23")
  
      # Unconventional channel pair: pass
      raw = raw_old.copy()
      info_new = create_info(
          ["S11_D1 hbo", "S11_D1 hbr"],
          raw.info["sfreq"],
          ["hbo", "hbr"],
      )
      new = RawArray(np.random.normal(size=(2, len(raw))), info_new)
      raw.add_channels([new], force_update_info=True)
      raw.set_montage("artinis-brite23")
  
      # Source not in montage: fail
      raw = raw_old.copy()
      info_new = create_info(
          ["S12_D7 hbo", "S12_D7 hbr"],
          raw.info["sfreq"],
          ["hbo", "hbr"],
      )
      new = RawArray(np.random.normal(size=(2, len(raw))), info_new)
      raw.add_channels([new], force_update_info=True)
      with pytest.raises(ValueError, match="is not in list"):
          raw.set_montage("artinis-brite23")
  
      # Detector not in montage: fail
      raw = raw_old.copy()
      info_new = create_info(
          ["S11_D8 hbo", "S11_D8 hbr"],
          raw.info["sfreq"],
          ["hbo", "hbr"],
      )
      new = RawArray(np.random.normal(size=(2, len(raw))), info_new)
      raw.add_channels([new], force_update_info=True)
      with pytest.raises(ValueError, match="is not in list"):
          raw.set_montage("artinis-brite23")
  
file_path: mne-python/mne/channels/tests/test_standard_montage.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_raises
  from mne import create_info
  from mne._fiff._digitization import _get_dig_eeg, _get_fid_coords
  from mne._fiff.constants import FIFF
  from mne.channels import compute_native_head_t, make_standard_montage
  from mne.channels.montage import HEAD_SIZE_DEFAULT, get_builtin_montages
  from mne.io import RawArray
  from mne.preprocessing.nirs import beer_lambert_law, optical_density
  from mne.transforms import _angle_between_quats, _get_trans, rot_to_quat
label_desc: Use image node_id 8 for calling a global function with example usage: test_set_montage_artinis_basic() without return types