need help to plot EEG topomaps with mne

I'm new to mne, and would like to compute some topographic voltage maps

I have two specific questions:
(i) The plot_topomap function plots 2D maps. Is there a way to plot 3D
maps?
(ii) My data_ is a 19 (electrodes) x 300 (datapoints) numpy array. Sampling
rate was 250 Hz, and the 300 datapoints correspond to a -200 1000 ms epoch
(0 being the stimulus-locking event).
-Is there a simple way to plot topographies at say, 300 ms after stimulus
onset, or topographies over the average of a given time window (300-500ms
after stimulus onset)?
-I need to provide the (x,y) coordinates for each EEG channel. My channels
are:
electrodes =
['F3','F4','C3','C4','P3','P4','PO3','PO4','O1','O2','OL','OR','T3','T4','T5','T6','Fz','Cz','Pz']
These electrodes are standard international 10/20 System sites, except OL
(halfway between 01 and T5) and OL (halfway between 02 and T6). Given these
locations, which coordinate array should I provide to the plot_topomap
function ?

Thanks for your help!
Mathieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160618/9afcb379/attachment.html

Hi Mathieu,
currently there is no way to project to 3d.

For the second point you could use a montage when reading the data. The
readers for EEG data have a montage parameter that you could use to set the
channel locations (see for example
http://mne-tools.github.io/dev/generated/mne.io.read_raw_edf.html#mne.io.read_raw_edf
and
http://mne-tools.github.io/dev/generated/mne.channels.read_montage.html#mne.channels.read_montage).
In your case, since you have some custom locations, one option would be to
manually add entries for 'OL' and 'OR' to the standard_1020.elc file, if
you know their locations.

-Jaakko

Hi Mathieu,

to complete Jaakko's answer, you can plot 3D EEG projection using mne.viz
import.evoked_field. For example:

import os.path as op
import mne
from mne.forward import make_field_map
from mne.viz import plot_evoked_field

# get data
data_path = mne.datasets.sample.data_path()
subjects_dir = data_path + '/subjects'
trans_fname = op.join(data_path, 'MEG', 'sample',
'sample_audvis_raw-trans.fif')
fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif')
evoked = mne.read_evokeds(fname, baseline=(None, 0), proj=True)[0]

# select eeg channels only
evoked.pick_types(eeg=True, meg=False)

# plot field maps
maps = make_field_map(evoked, trans=trans_fname, subjects_dir=subjects_dir,
                      subject='sample', n_jobs=-1, meg_surf='head')
plot_evoked_field(evoked, maps, time=.1)

Hope that helps,

Jean-R?mi

Hi Mathieu,

it's generally best to follow up your questions on the mailing list so that
others can checkout the archives.

To make an Evoked object you should be able to do:

from mne import EvokedArray, create_info
sampling_freq = 128
info = create_info(n_channels, sampling_freq, 'eeg')
evoked = EvokedArray(your_data_array, info=info, tmin=0.)

Then you can make a montage and attach it to the evoked object:

from mne.channels import Montage
kind = 2 # means eeg channels
montage = Montage(position_xyz, info, kind=2, range(n_channels))
evoked.set_montage(montage)

You can then use the plotting function that I described in the previous
email to plot in 3D. Note that MNE has a wider spectrum of functions for 2D
plottings (have a look at evoked.plot(), plot_topo(), plot_topomap(),
plot_*() methods). Tu use them you'll need to make a 2D layout
(mne.channels.make_eeg_layout).

Hope that helps,

JR

PS: yes I am :wink:

Hi Jean-R?mi (Are you French?)

Thanks for your help.
I've some difficulties with the mne.read_evokeds function. At the moment,
I have a grand average data 19(channels) x 300 (datapoints) numpy array and
a custom montage instance from the mne.channels.Montage map (see attached).
How could I proceed to (i) generate a read_evokeds() object, and (ii)
plot a 3D map in a specific time window...

Best,
Mathieu

Hi Mathieu,

to complete Jaakko's answer, you can plot 3D EEG projection using mne.viz
import.evoked_field. For example:

import os.path as op
import mne
from mne.forward import make_field_map
from mne.viz import plot_evoked_field

# get data
data_path = mne.datasets.sample.data_path()
subjects_dir = data_path + '/subjects'
trans_fname = op.join(data_path, 'MEG', 'sample',
'sample_audvis_raw-trans.fif')
fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif')
evoked = mne.read_evokeds(fname, baseline=(None, 0), proj=True)[0]

# select eeg channels only
evoked.pick_types(eeg=True, meg=False)

# plot field maps
maps = make_field_map(evoked, trans=trans_fname, subjects_dir=subjects_dir,
                      subject='sample', n_jobs=-1, meg_surf='head')
plot_evoked_field(evoked, maps, time=.1)

Hope that helps,

Jean-R?mi

Hi Mathieu,
currently there is no way to project to 3d.

For the second point you could use a montage when reading the data. The
readers for EEG data have a montage parameter that you could use to set the
channel locations (see for example
mne.io.read_raw_edf — MNE 1.7.0.dev17+g20174f448 documentation
and
http://mne-tools.github.io/dev/generated/mne.channels.read_montage.html#mne.channels.read_montage).
In your case, since you have some custom locations, one option would be to
manually add entries for 'OL' and 'OR' to the standard_1020.elc file, if
you know their locations.

-Jaakko

I'm new to mne, and would like to compute some topographic voltage maps
from my EEG grand-averaged data.

I have two specific questions:
(i) The plot_topomap function plots 2D maps. Is there a way to plot 3D
maps?
(ii) My data_ is a 19 (electrodes) x 300 (datapoints) numpy array.
Sampling rate was 250 Hz, and the 300 datapoints correspond to a -200 1000
ms epoch (0 being the stimulus-locking event).
-Is there a simple way to plot topographies at say, 300 ms after
stimulus onset, or topographies over the average of a given time window
(300-500ms after stimulus onset)?
-I need to provide the (x,y) coordinates for each EEG channel. My
channels are:
electrodes =
['F3','F4','C3','C4','P3','P4','PO3','PO4','O1','O2','OL','OR','T3','T4','T5','T6','Fz','Cz','Pz']
These electrodes are standard international 10/20 System sites, except
OL (halfway between 01 and T5) and OL (halfway between 02 and T6). Given
these locations, which coordinate array should I provide to the
plot_topomap function ?

Thanks for your help!
Mathieu

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom
it is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you
in error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you
in error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160621/9c0ad99b/attachment.html