在MNE Python中读取通道位置

2024-06-10 01:05:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我是MNE Python新手,正在使用EEGlab(Matlab)中的.set文件进行源代码估计分析。从EasyCaps的66个通道(64个EEG和2个EOG)记录数据,10-20个IS。在Matlab中,EEG.chanlocs正确显示每个电极的坐标(标签、类型、θ、半径、X、Y、Z、sph_θ、sph_phi、sph_半径、海胆、参考)。但我似乎无法在MNE Python中读取这些位置

import mne

#The .set files are imported ok
data_path = r"D:\EEGdata";
fname = data_path + '\ppt10.set'
mydata = mne.io.read_epochs_eeglab(fname)

#The data look ok, and channel labels are correctly displayed
mydata
mydata.plot()
mydata.ch_names

#But the channel locations are not found
mydata.plot_sensors()     #RuntimeError: No valid channel positions found

关于如何从.set文件中读取频道位置有什么建议吗?或者,如何根据EEG.chanlocs中的坐标手动创建位置

我也尝试使用默认的蒙太奇10-20,只选择我使用的频道,但我无法使它工作

#Create a montage based on the standard 1020, which includes 94 electrode labels in upper case
montage = mne.channels.make_standard_montage('standard_1020')
[ch_name.upper() for ch_name in mydata.ch_names] #it correctly convert the channel labels into upper case
mydata.ch_names = [ch_name.upper() for ch_name in mydata.ch_names] #doesn't work
#File "<ipython-input-62-69a7053dc310>", line 1, in <module>
#mydata.ch_names=[ch_name.upper() for ch_name in mydata.ch_names]
#AttributeError: can't set attribute

montage = mne.channels.make_standard_montage('standard_1020',mydata.ch_names]

我还认为可以使用转换工具将.set文件转换为.fif文件。我已经查看了在线文档,但找不到这样的工具。有什么想法吗


Tags: 文件nameinnameschannelchupperare
1条回答
网友
1楼 · 发布于 2024-06-10 01:05:12

我有一个类似的问题,我通过在运行mydata.plot_sensors()之前为mydata.set_montage(montage)添加一行来修复。您不需要将通道名称转换为大写,因为它们在MNE中不区分大小写

相关问题 更多 >