Get the Books

Enjoying these notebooks and want to support the work? Check out the practical books on Data Science, Visualisation, and Evolutionary Algorithms.

Get the books

Time Domain Analysis

Preamble

In [2]:
import mne

Dataset

Download sample data from Mike Cohen.

In [3]:
raw = mne.io.read_epochs_eeglab('sampleEEGdata.mat')
values = (raw.get_data().mean(axis=0).squeeze())
Extracting parameters from sampleEEGdata.mat...
99 matching events found
No baseline correction applied
Not setting metadata
0 projection items activated
Ready.
<ipython-input-3-a9cfe698c8c0>:1: RuntimeWarning: At least one epoch has multiple events. Only the latency of the first event will be retained.
  raw = mne.io.read_epochs_eeglab('sampleEEGdata.mat')

Plotting

All Channels in Time Domain (Butterfly Plot)

In [5]:
evoked = mne.EvokedArray(values, raw.info, tmin=-1)
evoked.plot(spatial_colors=True, time_unit='ms');

Single Channel (P1) in Time Domain

In [4]:
evoked = mne.EvokedArray(values, raw.info, tmin=-1)
evoked.pick_channels(['P1'])
evoked.plot(time_unit='ms');
Need more than one channel to make topography for eeg. Disabling interactivity.

Multiple Channels (FC6, T8, P1) in Time Domain

In [8]:
evoked = mne.EvokedArray(values, raw.info, tmin=-1)  # Convert it to an EvokedArray
evoked.pick_channels(['FC6', 'T8', 'P1'])
fig = evoked.plot(spatial_colors=True, time_unit='ms');

Support this work

You can support this work by getting the e-books. This notebook will always be available for free in its online format.