[med-svn] [python-mne] 42/52: ENH : adding keep_only_data_channels option to Epochs.average

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


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

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

commit f1f9e287ff66b2f218b67378a2a009e84ec015e5
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Fri Nov 4 21:25:28 2011 -0400

    ENH : adding keep_only_data_channels option to Epochs.average
---
 mne/epochs.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/mne/epochs.py b/mne/epochs.py
index 30ca4a3..608b1dd 100644
--- a/mne/epochs.py
+++ b/mne/epochs.py
@@ -260,7 +260,7 @@ class Epochs(object):
         start = int(round(event_samp + self.tmin * sfreq)) - first_samp
         stop = start + len(self.times)
         if start < 0:
-            return np.zeros((len(self.picks),len(self.times)))
+            return None
         epoch, _ = self.raw[self.picks, start:stop]
 
         if self.proj is not None:
@@ -292,6 +292,8 @@ class Epochs(object):
     def _is_good_epoch(self, data):
         """Determine if epoch is good
         """
+        if data is None:
+            return False
         n_times = len(self.times)
         if self.reject is None and self.flat is None:
             return True
@@ -386,9 +388,15 @@ class Epochs(object):
 
         return epochs
 
-    def average(self, dropCh=True):
+    def average(self, keep_only_data_channels=True):
         """Compute average of epochs
 
+        Parameters
+        ----------
+        keep_only_data_channels: bool
+            If False, all channels with be kept. Otherwise
+            only MEG and EEG channels are kept.
+
         Returns
         -------
         evoked : Evoked instance
@@ -415,7 +423,7 @@ class Epochs(object):
         evoked.last = int(np.sum(self.times > 0))
 
         # dropping EOG, ECG and STIM channels. Keeping only data
-        if(dropCh):
+        if keep_only_data_channels:
             data_picks = pick_types(evoked.info, meg=True, eeg=True,
                                           stim=False, eog=False, ecg=False,
                                           emg=False)

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