Hi,
I am trying to annotate muscle artifacts.
The code is below. PS: the data is generated
import numpy as np
import mne
from copy import deepcopy as dpcpy
from mne.preprocessing import annotate_muscle_zscore
np.random.seed(10)
data = np.random.rand(24,1024)
data1 = np.random.rand(24,251)
data_ = np.concatenate((data, data1),axis=1)
ch_names = ["Fp1", "Fp2", "F3", "F4", "C3", "C4", "P3", "P4", "O1", "O2", "F7", "F8", "T7", "T8", "P7", "P8", "Fz", "Cz", "Pz", "M1", "M2", "AFz", "CPz", "POz"]
montage = mne.channels.make_standard_montage('standard_1020')
info = mne.create_info(ch_names=ch_names, sfreq=1000, ch_types='eeg').set_montage(montage, match_case=False)
raw = mne.io.RawArray(data_,info, copy='data', verbose=False)
raw.set_eeg_reference(projection=True)
raw.notch_filter([60, 120])
threshold_muscle = 5
annot_muscle, scores_muscle = annotate_muscle_zscore(
raw,
ch_type="eeg",
threshold=threshold_muscle,
min_length_good=0.2,
filter_freq=[110, 140],
)
The TypeError i get is
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[31], line 3
1 threshold_muscle = 5
----> 3 annot_muscle, scores_muscle = annotate_muscle_zscore(raw)
File <decorator-gen-396>:12, in annotate_muscle_zscore(raw, threshold, ch_type, min_length_good, filter_freq, n_jobs, verbose)
File c:\Users\Starboy\AppData\Local\Programs\Python\Python312\Lib\site-packages\mne\preprocessing\artifact_detection.py:106, in annotate_muscle_zscore(raw, threshold, ch_type, min_length_good, filter_freq, n_jobs, verbose)
104 else:
105 ch_type = {"meg": False, ch_type: True}
--> 106 raw_copy.pick(**ch_type)
108 raw_copy.filter(
109 filter_freq[0],
110 filter_freq[1],
(...)
113 n_jobs=n_jobs,
114 )
115 raw_copy.apply_hilbert(envelope=True, n_jobs=n_jobs)
TypeError: pick() got an unexpected keyword argument 'meg'
I specified the channel type as eeg.
I donβt know where the error is coming from and why. I am using the example on the documentation
https://mne.tools/stable/auto_examples/preprocessing/muscle_detection.html#annotate-muscle-artifacts
Any help is appreciated. Thanks