[med-svn] [python-mne] 46/353: ENH : allowing event_id == None in Epochs
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:24:29 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 d1351e68719b5ba06c321464d892a832137a4cda
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Fri Jan 6 08:50:57 2012 +0100
ENH : allowing event_id == None in Epochs
---
mne/epochs.py | 10 ++++++----
mne/tests/test_epochs.py | 7 ++++++-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/mne/epochs.py b/mne/epochs.py
index 0ac01cf..bc7e788 100644
--- a/mne/epochs.py
+++ b/mne/epochs.py
@@ -23,8 +23,8 @@ class Epochs(object):
events : array, of shape [n_events, 3]
Returned by the read_events function
- event_id : int
- The id of the event to consider
+ event_id : int | None
+ The id of the event to consider. If None all events are used.
tmin : float
Start time before event
@@ -177,8 +177,10 @@ class Epochs(object):
dest_comp)
# Select the desired events
- selected = np.logical_and(events[:, 1] == 0, events[:, 2] == event_id)
- self.events = events[selected]
+ self.events = events
+ if event_id is not None:
+ selected = np.logical_and(events[:, 1] == 0, events[:, 2] == event_id)
+ self.events = self.events[selected]
n_events = len(self.events)
if n_events > 0:
diff --git a/mne/tests/test_epochs.py b/mne/tests/test_epochs.py
index 2712a36..ebf8ed8 100644
--- a/mne/tests/test_epochs.py
+++ b/mne/tests/test_epochs.py
@@ -6,7 +6,7 @@ import os.path as op
from nose.tools import assert_true
from numpy.testing import assert_array_equal, assert_array_almost_equal
-from .. import fiff, Epochs, read_events
+from .. import fiff, Epochs, read_events, pick_events
raw_fname = op.join(op.dirname(__file__), '..', 'fiff', 'tests', 'data',
'test_raw.fif')
@@ -33,6 +33,11 @@ def test_read_epochs():
epochs.average()
data = epochs.get_data()
+ epochs_no_id = Epochs(raw, pick_events(events, include=event_id),
+ None, tmin, tmax, picks=picks,
+ baseline=(None, 0))
+ assert_array_equal(data, epochs_no_id.get_data())
+
eog_picks = fiff.pick_types(raw.info, meg=False, eeg=False, stim=False,
eog=True)
epochs.drop_picks(eog_picks)
--
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