Skip to content

pick() got an unexpected keyword argument ‘meg’ #12402

@Iphykay

Description

@Iphykay

Description of the problem

I get a Type Error when I use annotate_muscle_zscore() method. I think its a bug.

Steps to reproduce

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],
)

Link to data

No response

Expected results

To get the annotations for segments that likely contain muscle artifacts.

Actual results


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 :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'

Additional information

Platform Windows-10-10.0.22631-SP0
Python 3.9.18 (main, Sep 11 2023, 14:09:26) [MSC v.1916 64 bit (AMD64)]
Executable C:\Users\Starboy.envBMindMNE\python.exe
CPU AMD64 Family 25 Model 68 Stepping 1, AuthenticAMD (16 cores)
Memory 15.2 GB

Core
├☒ mne 1.6.0 (outdated, release 1.6.1 is available!)
├☑ numpy 1.22.4 (MKL 2023.2-Product with 8 threads)
├☑ scipy 1.11.1
├☑ matplotlib 3.5.3 (backend=QtAgg)
├☑ pooch 1.7.0
└☑ jinja2 3.1.2

Numerical (optional)
├☑ sklearn 1.3.0
├☑ numba 0.57.1
├☑ nibabel 5.1.0
├☑ nilearn 0.10.1
├☑ dipy 1.7.0
├☑ openmeeg 2.5.6
├☑ pandas 2.1.0
└☐ unavailable cupy

Visualization (optional)
├☑ pyvista 0.42.1 (OpenGL 4.6.0 Compatibility Profile Context 24.1.1.240110 via AMD Radeon(TM) Graphics)
├☑ pyvistaqt 0.0.0
├☑ vtk 9.2.6
├☑ qtpy 2.4.0 (PyQt5=5.15.4)
├☑ ipympl 0.9.3
├☑ pyqtgraph 0.13.3
├☑ mne-qt-browser 0.5.2
├☑ ipywidgets 7.7.2
├☑ trame_client 2.15.0
├☑ trame_server 2.15.0
├☑ trame_vtk 2.7.1
└☑ trame_vuetify 2.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions