非官方中文翻译 本页译自 MNE-Python 官方文档: 查看英文原文 ↗。 文档版权归 MNE Developers 所有(BSD-3-Clause)。

如何使用神经集成(NEO)格式的数据#

本示例展示如何从神经集成(NEO)格式的数据创建 MNE-Python 的 Raw 对象。关于如何从 NumPy 数组创建 MNE-Python 数据对象的一般说明,请参阅 从零创建 MNE-Python 数据结构。

# Authors: The MNE-Python contributors.
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.

import neo

import mne

本示例使用 NEO 的 ExampleIO 对象生成模拟数据。数据全为零,因此绘图不会很有意思,但足以演示使用 NEO 数据的步骤。若要处理真实数据和不同文件格式,请查阅 NEO 文档。

reader = neo.io.ExampleIO("fakedata.nof")
block = reader.read(lazy=False)[0]  # get the first block
segment = block.segments[0]  # get data from first (and only) segment
signals = segment.analogsignals[0]  # get first (multichannel) signal

data = signals.rescale("V").magnitude.T
sfreq = signals.sampling_rate.magnitude
ch_names = [f"Neo {(idx + 1):02}" for idx in range(signals.shape[1])]
ch_types = ["eeg"] * len(ch_names)  # if not specified, type 'misc' is assumed

info = mne.create_info(ch_names=ch_names, ch_types=ch_types, sfreq=sfreq)
raw = mne.io.RawArray(data, info)
raw.plot(show_scrollbars=False)
Raw plot
Creating RawArray with float64 data, n_channels=8, n_times=100000
    Range : 0 ... 99999 =      0.000 ...    10.000 secs
Ready.

图库由 Sphinx-Gallery 生成