Sim*_*mon 5 python signal-processing numpy mne-python
我有以 3D numpy 数组(纪元 * 通道 * 时间点)形式出现的 EEG 数据。时间点是一个包含每个采样时间点的 256 个元素数组(总共 1 秒,频率为 256Hz)。epoch 是一个实验性的试验。
我正在尝试将 numpy 数组导入 Python-MNE ( http://martinos.org/mne/stable/mne-python.html ) 理解的表单中,但我遇到了一些麻烦
首先,我不确定是否应该将这些原始数据作为 RawArray 或 EpochsArray 导入。我用这个尝试了后者:
ch_names = list containing my 64 eeg channel names
allData = 3d numpy array as described above
info = mne.create_info(ch_names, 256, ch_types='eeg')
event_id = 1
#I got this from a tutorial but really unsure what it does and I think this may be the problem
events = np.array([200, event_id]) #I got this from a tutorial but really unsure what it does and I think this may be the problem
raw = mne.EpochsArray(allData, info, events=events)
picks = mne.pick_types(info, meg=False, eeg=True, misc=False)
raw.plot(picks=picks, show=True, block=True)
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我收到一个索引错误:“数组的索引太多”
最终我想对数据进行一些 STFT 和 CSP 分析,但现在我需要一些帮助来进行初始重组和导入 MNE。
导入这个 numpy 数据的正确方法是什么,最容易完成我的预期分析?
小智 0
有什么方法可以将从 EEG 设置中获取的数据转换为 .fif 格式吗?MNE 页面在其教程中讨论的“原始”数据格式是 .fif 格式文件。如果您可以将脑电图数据转换为 .fif 格式,那么您几乎可以按照教程一步一步进行操作...
从各种其他 EEG 文件格式转换为 .fif 的函数: http: //martinos.org/mne/stable/manual/convert.html
如果这不是一个选择,这里有一些想法:
EpochsArray() 看起来是正确的函数,因为它需要一个具有 (n_epochs, n_channels, n_times) 形状的数据数组。为了确定起见,请检查 allData 数组的形状是否与np.shape(allData).
在相关说明中,帮助页面EpochsArray()提到了mne.read_events()一个大问题,即您的事件数据可能存储在哪里以便您能够读取它......
根据您链接的教程,如果您从 .fif 文件开始,获取“事件”的方式似乎是:
events = mne.find_events(raw, stim_channel='STI 014')。这让我想知道你的 numpy 数组中是否有超过 64 个通道,并且其中一个通道实际上是刺激通道......如果是这种情况,你可以尝试将该刺激通道提供给函数mne.read_events()。或者,也许您的刺激或事件通道可能是一个单独的数组或可能未经处理?
希望这至少有一些帮助,祝你好运!