非官方中文翻译
本页译自 MNE-Python 官方文档:
查看英文原文 ↗。
文档版权归 MNE Developers 所有(BSD-3-Clause)。
说明
转到末尾下载完整示例代码。
对 MEG/EEG 通道插值坏道#
本示例展示如何对坏的 MEG/EEG 通道插值
对 EEG 数据使用 [1] 中的球面样条。
对 MEG 与 EEG 数据使用场插值。
本示例中坏通道仍标记为坏,只替换这些通道中的数据。
# Authors: Denis A. Engemann <denis.engemann@gmail.com>
# Mainak Jas <mainak.jas@telecom-paristech.fr>
#
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.
import mne
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
meg_path = data_path / "MEG" / "sample"
fname = meg_path / "sample_audvis-ave.fif"
evoked = mne.read_evokeds(fname, condition="Left Auditory", baseline=(None, 0))
# plot with bads
evoked.plot(exclude=[], picks=("grad", "eeg"))

Reading /home/circleci/mne_data/MNE-sample-data/MEG/sample/sample_audvis-ave.fif ...
Read a total of 4 projection items:
PCA-v1 (1 x 102) active
PCA-v2 (1 x 102) active
PCA-v3 (1 x 102) active
Average EEG reference (1 x 60) active
Found the data of interest:
t = -199.80 ... 499.49 ms (Left Auditory)
0 CTF compensation matrices available
nave = 55 - aspect type = 100
Projections have already been applied. Setting proj attribute to True.
Applying baseline correction (mode: mean)
计算插值(同样适用于 Raw 与 Epochs 对象)
evoked_interp = evoked.copy().interpolate_bads(reset_bads=False)
evoked_interp.plot(exclude=[], picks=("grad", "eeg"))

Setting channel interpolation method to {'eeg': 'spline', 'meg': 'MNE'}.
Interpolating bad channels.
Automatic origin fit: head of radius 91.2 mm
Computing interpolation matrix from 59 sensor positions
Interpolating 1 sensors
Computing dot products for 305 MEG channels...
Computing cross products for 305 → 1 MEG channel...
Preparing the mapping matrix...
Truncating at 85/305 components to omit less than 0.0001 (9.4e-05)
也可以对 EEG 与 MEG 使用最小范数方法
evoked_interp_mne = evoked.copy().interpolate_bads(
reset_bads=False, method=dict(eeg="MNE"), verbose=True
)
evoked_interp_mne.plot(exclude=[], picks=("grad", "eeg"))

Setting channel interpolation method to {'eeg': 'MNE', 'meg': 'MNE'}.
Interpolating bad channels.
Automatic origin fit: head of radius 91.2 mm
Computing dot products for 305 MEG channels...
Computing cross products for 305 → 1 MEG channel...
Preparing the mapping matrix...
Truncating at 85/305 components to omit less than 0.0001 (9.4e-05)
Computing dot products for 59 EEG channels...
Computing cross products for 59 → 60 EEG channels...
Preparing the mapping matrix...
Truncating at 58/59 components and regularizing with α=1.0e-01
The map has an average electrode reference (60 channels)
参考文献#
脚本总运行时间:(0 分 4.770 秒)