[med-svn] [python-mne] 327/353: FIX: reg. if cov. is subset of channels

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


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

yoh pushed a commit to tag 0.4
in repository python-mne.

commit 1e73c0d267a69e440082939c9c7a8a7b0b1808c6
Author: Martin Luessi <mluessi at nmr.mgh.harvard.edu>
Date:   Mon Jul 30 15:56:26 2012 -0400

    FIX: reg. if cov. is subset of channels
---
 mne/cov.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/mne/cov.py b/mne/cov.py
index 3c2c30c..a368a8c 100644
--- a/mne/cov.py
+++ b/mne/cov.py
@@ -483,11 +483,23 @@ def regularize(cov, info, mag=0.1, grad=0.1, eeg=0.1, exclude=None,
     sel_grad = pick_types(info, meg='grad', eeg=False, exclude=exclude)
 
     info_ch_names = info['ch_names']
+    ch_names_eeg = [info_ch_names[i] for i in sel_eeg]
+    ch_names_mag = [info_ch_names[i] for i in sel_mag]
+    ch_names_grad = [info_ch_names[i] for i in sel_grad]
+
     cov = pick_channels_cov(cov, include=info_ch_names, exclude=exclude)
     ch_names = cov.ch_names
-    idx_eeg = [ch_names.index(info_ch_names[c]) for c in sel_eeg]
-    idx_mag = [ch_names.index(info_ch_names[c]) for c in sel_mag]
-    idx_grad = [ch_names.index(info_ch_names[c]) for c in sel_grad]
+
+    idx_eeg, idx_mag, idx_grad = [], [], []
+    for ch in ch_names:
+        if ch in ch_names_eeg:
+            idx_eeg.append(ch_names.index(ch))
+        elif ch in ch_names_mag:
+            idx_mag.append(ch_names.index(ch))
+        elif ch in ch_names_grad:
+            idx_grad.append(ch_names.index(ch))
+        else:
+            raise Exception('channel is unknown type')
 
     C = cov['data']
 

-- 
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