braindecode.preprocessing.AnnotateMuscleZscore#
- class braindecode.preprocessing.AnnotateMuscleZscore(threshold=4, ch_type=None, min_length_good=0.1, filter_freq=(110, 140), n_jobs=None, verbose=None)[source]#
Braindecode preprocessor wrapper for
annotate_muscle_zscore().Create annotations for segments that likely contain muscle artifacts.
Detects data segments containing activity in the frequency range given by
filter_freqwhose envelope magnitude exceeds the specified z-score threshold, when summed across channels and divided bysqrt(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, ifch_typeisNoneit will select the first type in the listmag,grad,eeg. See [1] for background on choosingfilter_freqandthreshold.- Parameters:
- rawinstance of Raw
Data to estimate segments with muscle artifacts.
- thresholdfloat
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
Noneit will take the first type inmag,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 is0.1.- filter_freqarray-like, shape (2,)
The lower and upper frequencies of the band-pass filter. Default is
(110, 140).- n_jobsint | None
The number of jobs to run in parallel. If
-1, it is set to the number of CPU cores. Requires thejoblibpackage.None(default) is a marker for ‘unset’ that will be interpreted asn_jobs=1(sequential execution) unless the call is performed under ajoblib:joblib.parallel_configcontext manager that sets another value forn_jobs.- verbosebool | str | int | None
Control verbosity of the logging output. If
None, use the default verbosity level. See the logging documentation andmne.verbose()for details. Should only be passed as a keyword argument.
- Returns:
- annotmne.Annotations
Periods with muscle artifacts annotated as BAD_muscle.
- scores_musclearray
Z-score values averaged across channels for each sample.
Methods
- fn(threshold=4, ch_type=None, min_length_good=0.1, filter_freq=(110, 140), n_jobs=None, verbose=None)[source]#
Create annotations for segments that likely contain muscle artifacts.
Detects data segments containing activity in the frequency range given by
filter_freqwhose envelope magnitude exceeds the specified z-score threshold, when summed across channels and divided bysqrt(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, ifch_typeisNoneit will select the first type in the listmag,grad,eeg. See [1] for background on choosingfilter_freqandthreshold.- Parameters:
raw (instance of Raw) – Data to estimate segments with muscle artifacts.
threshold (float) – 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
Noneit will take the first type inmag,grad,eeg.min_length_good (float | 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 is0.1.filter_freq (array-like, shape (2,)) – The lower and upper frequencies of the band-pass filter. Default is
(110, 140).n_jobs (int | None) – The number of jobs to run in parallel. If
-1, it is set to the number of CPU cores. Requires thejoblibpackage.None(default) is a marker for ‘unset’ that will be interpreted asn_jobs=1(sequential execution) unless the call is performed under ajoblib:joblib.parallel_configcontext manager that sets another value forn_jobs.verbose (bool | str | int | None) – Control verbosity of the logging output. If
None, use the default verbosity level. See the logging documentation andmne.verbose()for details. Should only be passed as a keyword argument.
- Returns:
annot (mne.Annotations) – Periods with muscle artifacts annotated as BAD_muscle.
scores_muscle (array) – Z-score values averaged across channels for each sample.
References