.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/use_mne.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_use_mne.py: ===================================== Use ``eeg_positions`` with MNE-Python ===================================== For more information, check out these MNE resources: - https://mne.tools/dev/auto_tutorials/intro/plot_40_sensor_locations.html - https://mne.tools/dev/auto_examples/visualization/plot_eeglab_head_sphere.html .. currentmodule:: eeg_positions .. GENERATED FROM PYTHON SOURCE LINES 15-16 We start with imports. .. GENERATED FROM PYTHON SOURCE LINES 16-18 .. code-block:: Python from eeg_positions import get_elec_coords .. GENERATED FROM PYTHON SOURCE LINES 19-20 Now we get the positions we want. Note the ``as_mne_montage=True`` argument. .. GENERATED FROM PYTHON SOURCE LINES 20-26 .. code-block:: Python coords = get_elec_coords(as_mne_montage=True) # `coords` is an MNE-Python DigMontage object. print(coords) .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 27-29 Making use of the :class:`mne.channels.DigMontage` methods, we can visualize the electrode positions. .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: Python coords.plot() .. image-sg:: /auto_examples/images/sphx_glr_use_mne_001.png :alt: use mne :srcset: /auto_examples/images/sphx_glr_use_mne_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 33-34 Now let's have a look at plotting this in 3D. .. GENERATED FROM PYTHON SOURCE LINES 34-41 .. code-block:: Python # but let's pick a system that has fewer electrodes coords = get_elec_coords(system="1010", as_mne_montage=True) fig = coords.plot(kind="3d") fig.gca().view_init(azim=70, elev=15) .. image-sg:: /auto_examples/images/sphx_glr_use_mne_002.png :alt: use mne :srcset: /auto_examples/images/sphx_glr_use_mne_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 42-50 The above plot already looks useful, but you can make it even more useful if you run the code in an interactive session using the Matplotlib Qt backend, because then you can zoom and pan the plot. Finally, let's make a plot with the equator of the spherical head model lying on the ``"Fpz-T8-Oz-T7"`` electrode contour line. So far, we only saw it for ``"Nz-T10-Iz-T9"``, which is the recommended default. .. GENERATED FROM PYTHON SOURCE LINES 50-59 .. code-block:: Python # We are also picking the 10-20 system now coords = get_elec_coords(system="1020", as_mne_montage=True, equator="Fpz-T8-Oz-T7") # MNE always scales the electrode positions as if the equator were on the # "Nz-T10-Iz-T9" contour. # We need to counteract this by setting ``sphere="eeglab"``, which scales # electrode positions as if the equator were on the "Fpz-T8-Oz-T7" contour. coords.plot(sphere="eeglab") .. image-sg:: /auto_examples/images/sphx_glr_use_mne_003.png :alt: use mne :srcset: /auto_examples/images/sphx_glr_use_mne_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. _sphx_glr_download_auto_examples_use_mne.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: use_mne.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: use_mne.py `