[med-svn] [python-mne] 50/353: ENH : allowing multiple stim channels in mne.find_events
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 4b8d486d4e544e2e0e47620ae504979368bc14dd
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Fri Jan 6 17:43:33 2012 +0100
ENH : allowing multiple stim channels in mne.find_events
---
mne/event.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/mne/event.py b/mne/event.py
index 37ee112..ee8a10e 100644
--- a/mne/event.py
+++ b/mne/event.py
@@ -86,23 +86,25 @@ def find_events(raw, stim_channel='STI 014'):
raw : Raw object
The raw data
- stim_channel : string
- Name of the stim channel
+ stim_channel : string or list of string
+ Name of the stim channel or all the stim channels
+ affected by the trigger.
Returns
-------
events : array
The array of event onsets in time samples.
"""
+ if not isinstance(stim_channel, list):
+ stim_channel = [stim_channel]
- pick = pick_channels(raw.info['ch_names'], include=[stim_channel],
+ pick = pick_channels(raw.info['ch_names'], include=stim_channel,
exclude=[])
if len(pick) == 0:
raise ValueError('No stim channel found to extract event triggers.')
data, times = raw[pick, :]
- data = data.ravel()
- idx = np.where(np.diff(data.ravel()) > 0)[0]
- events_id = data[idx + 1].astype(np.int)
+ idx = np.where(np.all(np.diff(data, axis=1) > 0, axis=0))[0]
+ events_id = data[0, idx + 1].astype(np.int)
idx += raw.first_samp + 1
events = np.c_[idx, np.zeros_like(idx), events_id]
return events
--
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