Note
Go to the end to download the full example code.
How to use data in neural ensemble (NEO) format#
This example shows how to create an MNE-Python Raw
object from data
in the neural ensemble format. For general
information on creating MNE-Python’s data objects from NumPy arrays, see
Creating MNE-Python data structures from scratch.
# Authors: The MNE-Python contributors.
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.
import neo
import mne
This example uses NEO’s ExampleIO
object for creating fake data. The data will be
all zeros, so the plot won’t be very interesting, but it should demonstrate the steps
to using NEO data. For actual data and different file formats, consult the NEO
documentation.
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)
Creating RawArray with float64 data, n_channels=8, n_times=100000
Range : 0 ... 99999 = 0.000 ... 10.000 secs
Ready.
Using qt as 2D backend.
Total running time of the script: (0 minutes 1.827 seconds)