[med-svn] [python-mne] 08/376: cleaning exaples
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:21:55 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 6529715426ea5598e546d82eb9f5f866667cade8
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Tue Dec 28 15:49:26 2010 -0500
cleaning exaples
---
examples/read_evoked.py | 23 +++++++----------------
examples/read_raw.py | 25 +++++++++++++++++++------
2 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/examples/read_evoked.py b/examples/read_evoked.py
index 95c48c4..11a709d 100644
--- a/examples/read_evoked.py
+++ b/examples/read_evoked.py
@@ -1,25 +1,16 @@
+"""Reading an evoked file
+"""
+print __doc__
+
import fiff
fname = 'sm02a1-ave.fif'
-# fid, tree, directory = fiff.fiff_open(fname, verbose=True)
-# meas = fiff.tree.dir_tree_find(tree, fiff.FIFF.FIFFB_MEAS)
-# meas_info = fiff.tree.dir_tree_find(meas, fiff.FIFF.FIFFB_MEAS_INFO)
-
-# meas = fiff.evoked.read_meas_info(fname)
-# def is_tree(tree):
-# assert isinstance(tree, dict)
-# tree.block
-# for child in tree.children:
-# is_tree(child)
-#
-# is_tree(tree)
-# meas = fiff.tree.dir_tree_find(tree, fiff.FIFF.FIFFB_MEAS)
-# is_tree(meas)
-# meas_info = fiff.tree.dir_tree_find(meas, fiff.FIFF.FIFFB_MEAS_INFO)
-
data = fiff.read_evoked(fname)
+###############################################################################
+# Show result
+
import pylab as pl
pl.plot(data['evoked']['times'], data['evoked']['epochs'][:306,:].T)
pl.xlabel('time (ms)')
diff --git a/examples/read_raw.py b/examples/read_raw.py
index 9992a91..08c135d 100644
--- a/examples/read_raw.py
+++ b/examples/read_raw.py
@@ -1,15 +1,28 @@
+"""Reading a raw file segment
+"""
+print __doc__
+
+import pylab as pl
import fiff
fname = 'MNE-sample-data/MEG/sample/sample_audvis_raw.fif'
# fname = 'sm02a5_raw.fif'
-# fid, tree, directory = fiff.fiff_open(fname, verbose=True)
-
raw = fiff.setup_read_raw(fname)
-data, times = fiff.read_raw_segment(raw, from_=None, to=50000, sel=None)
-# import pylab as pl
-# pl.plot(data['evoked']['times'], data['evoked']['epochs'][:306,:].T)
-# pl.show()
+nchan = raw['info']['nchan']
+ch_names = raw['info']['ch_names']
+meg_channels_idx = [k for k in range(nchan) if ch_names[k][:3]=='MEG']
+meg_channels_idx = meg_channels_idx[:5]
+
+data, times = fiff.read_raw_segment_times(raw, from_=100, to=115,
+ sel=meg_channels_idx)
+
+###############################################################################
+# Show MEG data
+pl.plot(times, data.T)
+pl.xlabel('time (ms)')
+pl.ylabel('MEG data (T)')
+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