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


In [2]:
import mne


Download sample data from Mike Cohen.

In [3]:
raw ='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
<ipython-input-3-a9cfe698c8c0>:1: RuntimeWarning: At least one epoch has multiple events. Only the latency of the first event will be retained.
  raw ='sampleEEGdata.mat')


All Channels in Time Domain (Butterfly Plot)

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

Single Channel (P1) in Time Domain

In [4]:
evoked = mne.EvokedArray(values,, tmin=-1)
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,, 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.

Plotapi, beautiful by default.

Let plotapi do the heavy lifting – enabling beautiful interactive visualisations with a single line of code (instead of hundreds).

Get Plotapi