code: def test_muscle_annotation(meas_date, events):
      """Test correct detection muscle artifacts."""
      raw = read_raw_fif(raw_fname, allow_maxshield="yes").load_data()
      if meas_date is None:
          raw.set_meas_date(None)
      raw.notch_filter([50, 110, 150])
      # Check 2 muscle segments are detected
      annot_muscle, scores = annotate_muscle_zscore(
          raw, ch_type="mag", threshold=10
      )
      assert annot_muscle.orig_time == raw.info["meas_date"]
      onset = annot_muscle.onset * raw.info["sfreq"]
      if meas_date is not None:
          onset -= raw.first_samp
      onset = onset.astype(int)
      assert_array_equal(scores[onset].astype(int), np.array([23, 10]))
      assert annot_muscle.duration.size == 2
      raw.set_annotations(annot_muscle)
  
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 2 for calling a global function with example usage: test_muscle_annotation(meas_date, events) without return types