python-mne autoreject error: _setup_dots() missing 1 required positional argument: 'ch_type'

python-mne autoreject error: _setup_dots() missing 1 required positional argument: 'ch_type'

我正在使用 python mne 分析 MEG 数据。为了自动检测坏时期,我想使用基于 scikit-learn (http://autoreject.github.io/) 的 autoreject 包。

我已经创建了我的 epochs 并根据自动拒绝页面上给出的示例修改了代码,所以它看起来像这样:

n_interpolates = np.array([1, 4, 32])
consensus_percs = np.linspace(0, 1.0, 11)
picks = mne.pick_types(raw.info, meg='mag', stim=False, include=[], exclude=[])
ar = AutoReject(n_interpolates, consensus_percs, picks=picks,
            thresh_method='random_search', random_state=42)
epochs_clean = ar.fit_transform(epochs)

但是,如果我 运行 最后一行将 autoreject 应用于我的 epoch,我会收到以下错误消息:

_setup_dots() missing 1 required positional argument: 'ch_type'

完整的回溯在这里:

> epochs_clean = ar.fit_transform(epochs) 105 coil definitions read Traceback (most recent call last):

  File "<ipython-input-57-ae1b953bbd77>", line 1, in <module>
    epochs_clean = ar.fit_transform(epochs)

  File "/home/xxx/.local/lib/python3.8/site-packages/autoreject/autoreject.py", line 1110, in fit_transform
    return self.fit(epochs).transform(epochs, return_log=return_log)

  File "/home/xxx/.local/lib/python3.8/site-packages/autoreject/autoreject.py", line 960, in fit
    self.dots = _compute_dots(this_info)

  File "/home/xxx/.local/lib/python3.8/site-packages/autoreject/utils.py", line 426, in _compute_dots
    int_rad, noise, lut_fun, n_fact = _setup_dots(mode, coils, 'meg')

TypeError: _setup_dots() missing 1 required positional argument: 'ch_type'

我发现了这个问题,以防其他人遇到这个问题:

显然,通过 $ pip install -U autoreject 安装的 autoreject 版本有一些错误(util.py 文件中的一些函数需要比 autoreject.py 中的函数提供更多的变量]).

无论如何,可以安装一个运行良好的更新版本,如下所示:

$ pip install https://api.github.com/repos/autoreject/autoreject/zipball/master