Topographical Plots

Preamble

In [53]:
import mne

Dataset

Download sample data from Mike Cohen.

In [76]:
import warnings
warnings.filterwarnings("ignore")

def load_data(tmin, tmax):
    epochs = mne.io.read_epochs_eeglab('sampleEEGdata.mat').crop(tmin, tmax)
    return epochs

All Trials

In [77]:
raw = load_data(-1, 1)
values = (raw.get_data().mean(axis=0).squeeze())
evoked = mne.EvokedArray(values, raw.info, tmin=-1)
Extracting parameters from sampleEEGdata.mat...
99 matching events found
No baseline correction applied
Not setting metadata
0 projection items activated
Ready.

Plot Topographical Map at 0ms

In [78]:
evoked.plot_topomap(times=[0], time_unit='ms',cmap='Spectral_r');

Plot Topographical Map at 0ms, 500ms, and 1000ms

In [79]:
evoked.plot_topomap(times=[0, .5, 1], time_unit='ms',cmap='Spectral_r');

Plot First 5 Topographical Maps

In [87]:
evoked.plot_topomap(times=evoked.times[0:6], time_unit='ms',cmap='Spectral_r');

Plot Sensor Position

In [88]:
evoked.plot_sensors();

evoked.plot_sensors(kind='3d', ch_groups='position');

Single Trial

In [89]:
raw = load_data(-1, 1)
values = (raw[0].get_data().squeeze())
evoked = mne.EvokedArray(values, raw.info, tmin=-1)
Extracting parameters from sampleEEGdata.mat...
99 matching events found
No baseline correction applied
Not setting metadata
0 projection items activated
Ready.

Plot Topographical Map at 0ms

In [95]:
evoked.plot_topomap(times=[0], time_unit='ms',cmap='Spectral_r');

Plot Topographical Map at 0ms, 500ms, and 1000ms

In [96]:
evoked.plot_topomap(times=[0, .5, 1], time_unit='ms',cmap='Spectral_r');

Plot First 5 Topographical Maps

In [97]:
evoked.plot_topomap(times=evoked.times[0:6], time_unit='ms',cmap='Spectral_r');