[med-svn] [python-mne] 74/376: first attempt to be able to plot topographies

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:22:10 UTC 2015


This is an automated email from the git hooks/post-receive script.

yoh pushed a commit to annotated tag v0.1
in repository python-mne.

commit 4fb4c74005a94636c6cc2c048710de8c887d7764
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Mon Feb 14 14:41:03 2011 -0500

    first attempt to be able to plot topographies
---
 examples/plot_topography.py | 34 ++++++++++++++++++++++++++++++++++
 mne/viz.py                  | 30 ++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/examples/plot_topography.py b/examples/plot_topography.py
new file mode 100644
index 0000000..e38379e
--- /dev/null
+++ b/examples/plot_topography.py
@@ -0,0 +1,34 @@
+"""
+=================================
+Plot topographies for MEG sensors
+=================================
+
+"""
+
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD (3-clause)
+
+print __doc__
+
+import os
+import pylab as pl
+
+from mne import fiff
+from mne.layouts import Layout
+from mne.viz import plot_topo
+
+fname = os.environ['MNE_SAMPLE_DATASET_PATH']
+fname += '/MEG/sample/sample_audvis-ave.fif'
+
+# Reading
+data = fiff.read_evoked(fname, setno=0, baseline=(None, 0))
+
+layout = Layout('Vectorview-all')
+
+###############################################################################
+# Show topography
+plot_topo(data, layout)
+title = 'MNE sample data (condition : %s)' % data['evoked']['comment']
+pl.figtext(0.03, 0.93, title, color='w', fontsize=18)
+pl.show()
\ No newline at end of file
diff --git a/mne/viz.py b/mne/viz.py
new file mode 100644
index 0000000..1763c46
--- /dev/null
+++ b/mne/viz.py
@@ -0,0 +1,30 @@
+"""Functions to plot M/EEG data e.g. topographies
+"""
+
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: Simplified BSD
+
+import pylab as pl
+
+
+def plot_topo(data, layout):
+    """Plot 2D topographies
+    """
+    ch_names = data['info']['ch_names']
+    times = data['evoked']['times']
+    epochs = data['evoked']['epochs']
+
+    pl.rcParams['axes.edgecolor'] = 'w'
+    pl.figure(facecolor='k')
+    for name in layout.names:
+        if name in ch_names:
+            idx = ch_names.index(name)
+            ax = pl.axes(layout.pos[idx], axisbg='k')
+            ax.plot(times, epochs[idx,:], 'w')
+            pl.xticks([], ())
+            pl.yticks([], ())
+
+    pl.show()
+    pl.rcParams['axes.edgecolor'] = 'k'
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git



More information about the debian-med-commit mailing list