Plotting sensor layouts of EEG systems

This example illustrates how to load all the EEG system montages shipped in MNE-python, and display it on fsaverage template.

# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#          Joan Massich <mailsik@gmail.com>
#
# License: BSD Style.

import os.path as op

import mne
from mne.channels.montage import get_builtin_montages
from mne.datasets import fetch_fsaverage
from mne.viz import set_3d_title, set_3d_view

Check all montages against a sphere

for current_montage in get_builtin_montages():
    montage = mne.channels.make_standard_montage(current_montage)
    info = mne.create_info(
        ch_names=montage.ch_names, sfreq=100., ch_types='eeg')
    info.set_montage(montage)
    sphere = mne.make_sphere_model(r0='auto', head_radius='auto', info=info)
    fig = mne.viz.plot_alignment(
        # Plot options
        show_axes=True, dig='fiducials', surfaces='head',
        bem=sphere, info=info)
    set_3d_view(figure=fig, azimuth=135, elevation=80)
    set_3d_title(figure=fig, title=current_montage)
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage

Out:

Fitted sphere radius:         95.0 mm
Origin head coordinates:      -0.0 8.9 41.8 mm
Origin device coordinates:    -0.0 8.9 41.8 mm

Equiv. model fitting -> RV = 0.00409145 %
mu1 = 0.94356    lambda1 = 0.140105
mu2 = 0.664139    lambda2 = 0.686907
mu3 = 0.0431025    lambda3 = -0.0166422
Set up EEG sphere model with scalp radius    95.0 mm

Fitted sphere radius:         94.0 mm
Origin head coordinates:      -0.0 3.0 36.1 mm
Origin device coordinates:    -0.0 3.0 36.1 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    94.0 mm

Fitted sphere radius:         94.0 mm
Origin head coordinates:      0.0 3.0 36.1 mm
Origin device coordinates:    0.0 3.0 36.1 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    94.0 mm

Fitted sphere radius:         95.5 mm
Origin head coordinates:      0.0 0.5 31.9 mm
Origin device coordinates:    0.0 0.5 31.9 mm

Equiv. model fitting -> RV = 0.00372821 %
mu1 = 0.943946    lambda1 = 0.139079
mu2 = 0.665521    lambda2 = 0.684839
mu3 = -0.0973038    lambda3 = -0.013548
Set up EEG sphere model with scalp radius    95.5 mm

Fitted sphere radius:         95.5 mm
Origin head coordinates:      0.0 0.6 31.9 mm
Origin device coordinates:    0.0 0.6 31.9 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    95.5 mm

Fitted sphere radius:         94.1 mm
Origin head coordinates:      -0.0 3.8 35.8 mm
Origin device coordinates:    -0.0 3.8 35.8 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    94.1 mm

Fitted sphere radius:         94.3 mm
Origin head coordinates:      -0.0 3.4 41.0 mm
Origin device coordinates:    -0.0 3.4 41.0 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    94.3 mm

Fitted sphere radius:         94.1 mm
Origin head coordinates:      -0.0 3.4 41.0 mm
Origin device coordinates:    -0.0 3.4 41.0 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    94.1 mm

Fitted sphere radius:         95.0 mm
Origin head coordinates:      -0.0 0.0 40.1 mm
Origin device coordinates:    -0.0 0.0 40.1 mm

Equiv. model fitting -> RV = 0.00409145 %
mu1 = 0.94356    lambda1 = 0.140105
mu2 = 0.664139    lambda2 = 0.686907
mu3 = 0.0431025    lambda3 = -0.0166422
Set up EEG sphere model with scalp radius    95.0 mm

Fitted sphere radius:         95.0 mm
Origin head coordinates:      -0.0 0.0 40.1 mm
Origin device coordinates:    -0.0 0.0 40.1 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    95.0 mm

Fitted sphere radius:         95.0 mm
Origin head coordinates:      -0.0 -0.0 40.1 mm
Origin device coordinates:    -0.0 -0.0 40.1 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    95.0 mm

Fitted sphere radius:         95.0 mm
Origin head coordinates:      -0.0 0.0 40.1 mm
Origin device coordinates:    -0.0 0.0 40.1 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    95.0 mm

Fitted sphere radius:         95.0 mm
Origin head coordinates:      -0.0 0.0 40.1 mm
Origin device coordinates:    -0.0 0.0 40.1 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    95.0 mm

Fitted sphere radius:         95.0 mm
Origin head coordinates:      0.0 -0.0 40.1 mm
Origin device coordinates:    0.0 -0.0 40.1 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    95.0 mm

Fitted sphere radius:         95.0 mm
Origin head coordinates:      -0.0 0.0 40.1 mm
Origin device coordinates:    -0.0 0.0 40.1 mm

Equiv. model fitting -> RV = 0.00372821 %
mu1 = 0.943946    lambda1 = 0.139079
mu2 = 0.665521    lambda2 = 0.684839
mu3 = -0.0973038    lambda3 = -0.013548
Set up EEG sphere model with scalp radius    95.0 mm

Fitted sphere radius:         95.0 mm
Origin head coordinates:      0.0 0.0 40.1 mm
Origin device coordinates:    0.0 0.0 40.1 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    95.0 mm

Fitted sphere radius:         94.2 mm
Origin head coordinates:      0.9 6.9 48.9 mm
Origin device coordinates:    0.9 6.9 48.9 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    94.2 mm

Fitted sphere radius:         94.4 mm
Origin head coordinates:      1.0 6.6 48.1 mm
Origin device coordinates:    1.0 6.6 48.1 mm

Equiv. model fitting -> RV = 0.00409145 %
mu1 = 0.94356    lambda1 = 0.140105
mu2 = 0.664139    lambda2 = 0.686907
mu3 = 0.0431025    lambda3 = -0.0166422
Set up EEG sphere model with scalp radius    94.4 mm

Fitted sphere radius:         95.9 mm
Origin head coordinates:      0.9 6.8 46.5 mm
Origin device coordinates:    0.9 6.8 46.5 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    95.9 mm

Fitted sphere radius:         94.6 mm
Origin head coordinates:      0.8 6.1 43.2 mm
Origin device coordinates:    0.8 6.1 43.2 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    94.6 mm

Fitted sphere radius:         96.5 mm
Origin head coordinates:      0.9 6.5 45.0 mm
Origin device coordinates:    0.9 6.5 45.0 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    96.5 mm

Fitted sphere radius:         95.9 mm
Origin head coordinates:      0.9 5.6 45.0 mm
Origin device coordinates:    0.9 5.6 45.0 mm

Equiv. model fitting -> RV = 0.00372821 %
mu1 = 0.943946    lambda1 = 0.139079
mu2 = 0.665521    lambda2 = 0.684839
mu3 = -0.0973038    lambda3 = -0.013548
Set up EEG sphere model with scalp radius    95.9 mm

Fitted sphere radius:         94.7 mm
Origin head coordinates:      1.0 5.7 42.9 mm
Origin device coordinates:    1.0 5.7 42.9 mm

Equiv. model fitting -> RV = 0.00349028 %
mu1 = 0.944696    lambda1 = 0.137193
mu2 = 0.667458    lambda2 = 0.683737
mu3 = -0.26815    lambda3 = -0.0105603
Set up EEG sphere model with scalp radius    94.7 mm

Fitted sphere radius:         95.9 mm
Origin head coordinates:      0.9 5.6 45.0 mm
Origin device coordinates:    0.9 5.6 45.0 mm

Equiv. model fitting -> RV = 0.00372821 %
mu1 = 0.943946    lambda1 = 0.139079
mu2 = 0.665521    lambda2 = 0.684839
mu3 = -0.0973038    lambda3 = -0.013548
Set up EEG sphere model with scalp radius    95.9 mm

Check all montages against fsaverage

subjects_dir = op.dirname(fetch_fsaverage())

for current_montage in get_builtin_montages():
    montage = mne.channels.make_standard_montage(current_montage)
    # Create dummy info
    info = mne.create_info(
        ch_names=montage.ch_names, sfreq=100., ch_types='eeg')
    info.set_montage(montage)
    fig = mne.viz.plot_alignment(
        # Plot options
        show_axes=True, dig='fiducials', surfaces='head', mri_fiducials=True,
        subject='fsaverage', subjects_dir=subjects_dir, info=info,
        coord_frame='mri',
        trans='fsaverage',  # transform from head coords to fsaverage's MRI
    )
    set_3d_view(figure=fig, azimuth=135, elevation=80)
    set_3d_title(figure=fig, title=current_montage)
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage
  • plot montage

Out:

0 files missing from /home/circleci/project/mne/datasets/_fsaverage/root.txt in /home/circleci/mne_data/MNE-sample-data/subjects
0 files missing from /home/circleci/project/mne/datasets/_fsaverage/bem.txt in /home/circleci/mne_data/MNE-sample-data/subjects/fsaverage
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.
Using outer_skin.surf for head surface.

Total running time of the script: ( 1 minutes 36.084 seconds)

Estimated memory usage: 468 MB

Gallery generated by Sphinx-Gallery