code: def test_movement_annotation_head_correction(meas_date):
      """Test correct detection movement artifact and dev_head_t."""
      raw = read_raw_fif(raw_fname, allow_maxshield="yes").load_data()
      pos = read_head_pos(pos_fname)
      if meas_date is None:
          raw.set_meas_date(None)
      else:
          assert meas_date == "orig"
  
      # Check 5 rotation segments are detected
      annot_rot, [] = annotate_movement(
          raw, pos, rotation_velocity_limit=5
      )
      assert annot_rot.orig_time == raw.info["meas_date"]
      assert annot_rot.duration.size == 5
  
      # Check 2 translation vel. segments are detected
      annot_tra, [] = annotate_movement(
          raw, pos, translation_velocity_limit=0.05
      )
      assert annot_tra.duration.size == 2
  
      # Check 1 movement distance segment is detected
      annot_dis, _ = annotate_movement(
          raw, pos, mean_distance_limit=0.02
      )
      assert annot_dis.duration.size == 1
  
      # Check correct trans mat
      annot_all_2 = annotate_movement(
          raw,
          pos,
          rotation_velocity_limit=5,
          translation_velocity_limit=0.05,
          mean_distance_limit=0.02,
      )[0]
      assert (
          annot_rot.orig_time
          == annot_tra.orig_time
          == annot_dis.orig_time
          == raw.info["meas_date"]
      )
      annot_all = annot_rot + annot_tra + annot_dis
      _assert_annotations_equal(annot_all_2, annot_all)
      assert annot_all.orig_time == raw.info["meas_date"]
      raw.set_annotations(annot_all)
      dev_head_t = compute_average_dev_head_t(raw, pos)
  
      dev_head_t_ori = np.array(
          [
              [0.9957292, -0.08688804, 0.03120615, 0.00698271],
              [0.09020767, 0.9875856, -0.12859731, -0.0159098],
              [-0.01964518, 0.1308631, 0.99120578, 0.07258289],
              [0.0, 0.0, 0.0, 1.0],
          ]
      )
  
      assert_allclose(
          dev_head_t_ori, dev_head_t["trans"], rtol=1e-5, atol=0
      )
  
      # Smoke test skipping time due to previous annotations.
      raw.set_annotations(Annotations([raw.times[0]], 0.1, "bad"))
      annot_dis, _ = annotate_movement(
          raw, pos, mean_distance_limit=0.02
      )
      assert annot_dis.duration.size == 1
  
file_path: mne-python/mne/preprocessing/tests/test_artifact_detection.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from mne import Annotations, events_from_annotations
  from mne.chpi import read_head_pos
  from mne.datasets import testing
  from mne.io import read_raw_fif
  from mne.preprocessing import annotate_break, annotate_movement, annotate_muscle_zscore, compute_average_dev_head_t
  from mne.tests.test_annotations import _assert_annotations_equal
label_desc: Use image node_id 1 for calling a global function with example usage: test_movement_annotation_head_correction(meas_date) without return types