mne.preprocessing.annotate_muscle_zscore(raw, threshold=4, ch_type=None, min_length_good=0.1, filter_freq=(110, 140), n_jobs=1, verbose=None)[source]

Create annotations for segments that likely contain muscle artifacts.

Detects data segments containing activity in the frequency range given by filter_freq whose envelope magnitude exceeds the specified z-score threshold, when summed across channels and divided by sqrt(n_channels). False-positive transient peaks are prevented by low-pass filtering the resulting z-score time series at 4 Hz. Only operates on a single channel type, if ch_type is None it will select the first type in the list mag, grad, eeg. See 1 for background on choosing filter_freq and threshold.

rawinstance of Raw

Data to estimate segments with muscle artifacts.


The threshold in z-scores for marking segments as containing muscle activity artifacts.

ch_type‘mag’ | ‘grad’ | ‘eeg’ | None

The type of sensors to use. If None it will take the first type in mag, grad, eeg.

min_length_goodfloat | None

The shortest allowed duration of “good data” (in seconds) between adjacent annotations; shorter segments will be incorporated into the surrounding annotations.``None`` is equivalent to 0. Default is 0.1.

filter_freqarray_like, shape (2,)

The lower and upper frequencies of the band-pass filter. Default is (110, 140).


The number of jobs to run in parallel (default 1). Requires the joblib package.

verbosebool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more). If used, it should be passed as a keyword-argument only.


Periods with muscle artifacts annotated as BAD_muscle.


Z-score values averaged across channels for each sample.



Suresh Muthukumaraswamy. High-frequency brain activity and muscle artifacts in MEG/EEG: a review and recommendations. Frontiers in Human Neuroscience, 7:138, 2013. doi:10.3389/fnhum.2013.00138.

Examples using mne.preprocessing.annotate_muscle_zscore