MNE-python官网文章《handling bad channels》(以下简称《文章》,来源——文章链接)阅读及个人实操
根据《文章》内代码,并根据个人理解,编写如下代码:
# handling bad channelsimport os
from copy import deepcopy
import numpy as np
import mne
import matplotlib.pyplot as plt
# get the sample data
sample_data_path = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_path,'MEG','sample','sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False)# marking bad channels# 1.output the stored bad channelsprint(raw.info['bads'])# pick the 'EEG 05'channel for showing in plot
picks = mne.pick_channels_regexp(raw.ch_names, regexp='EEG 05.')# picks:这里mne.pick_channels_regexp返回的是一个 int型array,# 存储raw对象ch_names中同regexp value值相似或相同的channel name的Indices# print('len of picks: ', len(picks)) # from EEG 050-EEG059,Total number: 10# raw.plot(order=picks, n_channels=len(picks))# plt.show()
picks = mne.pi