Skip to content

Commit

Permalink
Add plot_montage (that uses the same code as plot_eeg_no_mri)
Browse files Browse the repository at this point in the history
  • Loading branch information
massich committed Apr 16, 2019
1 parent 32e1452 commit 8be92ab
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
62 changes: 62 additions & 0 deletions examples/visualization/plot_montage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
"""
Plotting sensor layouts of EEG Systems
======================================
Show sensor layouts of different EEG systems.
""" # noqa
# Authors: Alexandre Gramfort <[email protected]>
# Joan Massich <[email protected]>
#
# License: BSD Style.

from mayavi import mlab
import os.path as op

import mne
from mne.channels.montage import get_builtin_montages
from mne.viz import plot_alignment

# print(__doc__)

subjects_dir = op.join(mne.datasets.sample.data_path(), 'subjects')

###############################################################################
# check all montages
#

fix_units = {'EGI_256': 'cm', 'GSN-HydroCel-128': 'cm',
'GSN-HydroCel-129': 'cm', 'GSN-HydroCel-256': 'cm',
'GSN-HydroCel-257': 'cm', 'GSN-HydroCel-32': 'cm',
'GSN-HydroCel-64_1.0': 'cm', 'GSN-HydroCel-65_1.0': 'cm',
'biosemi128': 'mm', 'biosemi16': 'mm', 'biosemi160': 'mm',
'biosemi256': 'mm', 'biosemi32': 'mm', 'biosemi64': 'mm',
'easycap-M1': 'mm', 'easycap-M10': 'mm',
'mgh60': 'm', 'mgh70': 'm',
'standard_1005': 'm', 'standard_1020': 'm',
'standard_alphabetic': 'm',
'standard_postfixed': 'm',
'standard_prefixed': 'm',
'standard_primed': 'm'}

###############################################################################
# check all montages
#

for current_montage in get_builtin_montages():
montage = mne.channels.read_montage(current_montage,
unit=fix_units[current_montage],
transform=False)

info = mne.create_info(ch_names=montage.ch_names,
sfreq=1,
ch_types='eeg',
montage=montage)

fig = plot_alignment(info, trans=None,
subject='fsaverage',
subjects_dir=subjects_dir,
eeg=['original', 'projected'],
)
mlab.view(135, 80)
mlab.title(montage.kind, figure=fig)
2 changes: 1 addition & 1 deletion mne/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
'datasets/foo.tgz',
misc='https://codeload.github.com/mne-tools/mne-misc-data/'
'tar.gz/%s' % releases['misc'],
sample="https://osf.io/86qa2/download",
sample="https://osf.io/j4ms3/download",
somato='https://osf.io/tp4sg/download',
spm='https://osf.io/je4s8/download',
testing='https://codeload.github.com/mne-tools/mne-testing-data/'
Expand Down

0 comments on commit 8be92ab

Please sign in to comment.