[med-svn] [python-mne] 158/353: FIX : fix negative triggers due to old neuromag system

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:24:49 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 504d484d85ebb577943899b5589eeff9d2a67d5a
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Thu Apr 26 18:57:32 2012 +0200

    FIX : fix negative triggers due to old neuromag system
---
 mne/event.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mne/event.py b/mne/event.py
index ff9ddca..1b5d0a5 100644
--- a/mne/event.py
+++ b/mne/event.py
@@ -6,6 +6,7 @@
 #
 # License: BSD (3-clause)
 
+import warnings
 import numpy as np
 
 from .fiff.constants import FIFF
@@ -154,10 +155,17 @@ def find_events(raw, stim_channel='STI 014'):
     if len(pick) == 0:
         raise ValueError('No stim channel found to extract event triggers.')
     data, times = raw[pick, :]
+    if np.any(data < 0):
+        warnings.warn('Trigger channel contains negative values. '
+                      'Taking absolute value.')
+        data = np.abs(data)  # make sure trig channel is positive
+    data = data.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]
+    print "%s events found" % len(events)
+    print "Events id: %s" % np.unique(events[:, 2])
     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