[med-svn] [python-mne] 62/376: adding example of forward field whitening

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:22:07 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 aa2ca9522ff169235bc6ad279d77eced36ebd9b3
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Mon Jan 31 17:18:02 2011 -0500

    adding example of forward field whitening
---
 examples/plot_whiten_forward_solution.py | 43 ++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/examples/plot_whiten_forward_solution.py b/examples/plot_whiten_forward_solution.py
new file mode 100644
index 0000000..0faa4a4
--- /dev/null
+++ b/examples/plot_whiten_forward_solution.py
@@ -0,0 +1,43 @@
+"""
+========================================================
+Whiten a forward operator with a noise covariance matrix
+========================================================
+"""
+# Author: Alexandre Gramfort <gramfort at nmr.mgh.harvard.edu>
+#
+# License: BSD (3-clause)
+
+print __doc__
+
+import os
+import mne
+from mne import fiff
+
+fwd_fname = os.environ['MNE_SAMPLE_DATASET_PATH']
+fwd_fname += '/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif'
+ave_fname = os.environ['MNE_SAMPLE_DATASET_PATH']
+ave_fname += '/MEG/sample/sample_audvis-ave.fif'
+cov_fname = os.environ['MNE_SAMPLE_DATASET_PATH']
+cov_fname += '/MEG/sample/sample_audvis-cov.fif'
+
+# Reading
+ave = fiff.read_evoked(ave_fname, setno=0, baseline=(None, 0))
+fwd = mne.read_forward_solution(fwd_fname)
+
+cov = mne.Covariance()
+cov.load(cov_fname)
+
+ave_whiten, fwd_whiten, W = cov.whiten_evoked_and_forward(ave, fwd, eps=0.2)
+
+leadfield = fwd_whiten['sol']['data']
+
+print "Leadfield size : %d x %d" % leadfield.shape
+
+###############################################################################
+# Show result
+import pylab as pl
+pl.matshow(leadfield[:306,:500])
+pl.xlabel('sources')
+pl.ylabel('sensors')
+pl.title('Lead field matrix')
+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