[med-svn] [python-mne] 143/376: using plot_evoked in plot_whitened_evoked_data.py
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:22:23 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 efbbc259f7ee0b8e3f0078ab7fb49b980645355b
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Wed Mar 16 12:23:42 2011 -0400
using plot_evoked in plot_whitened_evoked_data.py
---
examples/plot_whitened_evoked_data.py | 28 ++++------------------------
mne/viz.py | 11 ++++++++---
2 files changed, 12 insertions(+), 27 deletions(-)
diff --git a/examples/plot_whitened_evoked_data.py b/examples/plot_whitened_evoked_data.py
index af01bbc..5a6c48b 100644
--- a/examples/plot_whitened_evoked_data.py
+++ b/examples/plot_whitened_evoked_data.py
@@ -12,6 +12,7 @@ print __doc__
import mne
from mne import fiff
+from mne.viz import plot_evoked
from mne.datasets import sample
data_path = sample.data_path('.')
@@ -25,29 +26,8 @@ cov.load(cov_fname)
evoked_whiten, W = cov.whiten_evoked(evoked)
-bads = evoked_whiten.info['bads']
-ind_meg_grad = fiff.pick_types(evoked.info, meg='grad', exclude=bads)
-ind_meg_mag = fiff.pick_types(evoked.info, meg='mag', exclude=bads)
-ind_eeg = fiff.pick_types(evoked.info, meg=False, eeg=True, exclude=bads)
-
###############################################################################
# Show result
-import pylab as pl
-pl.clf()
-pl.subplot(3, 1, 1)
-pl.plot(evoked.times, evoked_whiten.data[ind_meg_grad,:].T)
-pl.title('MEG Planar Gradiometers')
-pl.xlabel('time (s)')
-pl.ylabel('MEG data')
-pl.subplot(3, 1, 2)
-pl.plot(evoked.times, evoked_whiten.data[ind_meg_mag,:].T)
-pl.title('MEG Magnetometers')
-pl.xlabel('time (s)')
-pl.ylabel('MEG data')
-pl.subplot(3, 1, 3)
-pl.plot(evoked.times, evoked_whiten.data[ind_eeg,:].T)
-pl.title('EEG')
-pl.xlabel('time (s)')
-pl.ylabel('EEG data')
-pl.subplots_adjust(0.1, 0.08, 0.94, 0.94, 0.2, 0.63)
-pl.show()
+picks = fiff.pick_types(evoked_whiten.info, meg=True, eeg=True,
+ exclude=evoked_whiten.info['bads']) # Pick channels to view
+plot_evoked(evoked_whiten, picks, unit=False) # plot without SI unit of data
diff --git a/mne/viz.py b/mne/viz.py
index f06b611..7b3bc04 100644
--- a/mne/viz.py
+++ b/mne/viz.py
@@ -29,7 +29,7 @@ def plot_topo(evoked, layout):
pl.rcParams['axes.edgecolor'] = 'k'
-def plot_evoked(evoked, picks=None):
+def plot_evoked(evoked, picks=None, unit=True):
"""Plot evoked data
Parameters
@@ -38,6 +38,8 @@ def plot_evoked(evoked, picks=None):
The evoked data
picks : None | array-like of int
The indices of channels to plot. If None show all.
+ unit : bool
+ Scale plot with channel (SI) unit.
"""
pl.clf()
if picks is None:
@@ -52,10 +54,13 @@ def plot_evoked(evoked, picks=None):
counter = 1
times = 1e3 * evoked.times # time in miliseconds
- for t, scaling, name, unit in zip(['eeg', 'grad', 'mag'],
+ for t, scaling, name, ch_unit in zip(['eeg', 'grad', 'mag'],
[1e6, 1e13, 1e15],
['EEG', 'Gradiometers', 'Magnetometers'],
['uV', 'fT/cm', 'fT']):
+ if unit is False:
+ scaling = 1.0
+ ch_unit = 'NA' # no unit
idx = [picks[i] for i in range(len(picks)) if types[i] is t]
if len(idx) > 0:
pl.subplot(n_channel_types, 1, counter)
@@ -63,7 +68,7 @@ def plot_evoked(evoked, picks=None):
pl.title(name)
pl.xlabel('time (ms)')
counter += 1
- pl.ylabel('data (%s)' % unit)
+ pl.ylabel('data (%s)' % ch_unit)
pl.subplots_adjust(0.175, 0.08, 0.94, 0.94, 0.2, 0.63)
pl.show()
--
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