[med-svn] [python-mne] 314/376: TEST: test find ECG peaks
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:23:14 UTC 2015
This is an automated email from the git hooks/post-receive script.
yoh pushed a commit to annotated tag v0.1
in repository python-mne.
commit a76551d0dc907372c999e275e03ce732944fe982
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Thu Jul 7 12:01:32 2011 +0200
TEST: test find ECG peaks
---
mne/artifacts/tests/test_ecg.py | 20 ++++++++++++++++++++
mne/fiff/raw.py | 3 +++
2 files changed, 23 insertions(+)
diff --git a/mne/artifacts/tests/test_ecg.py b/mne/artifacts/tests/test_ecg.py
new file mode 100644
index 0000000..66d8cb0
--- /dev/null
+++ b/mne/artifacts/tests/test_ecg.py
@@ -0,0 +1,20 @@
+import os.path as op
+
+from numpy.testing import assert_array_almost_equal
+
+from ...fiff import Raw
+from ..ecg import find_ecg_events
+
+data_path = op.join(op.dirname(__file__), '..', '..', 'fiff', 'tests', 'data')
+raw_fname = op.join(data_path, 'test_raw.fif')
+event_fname = op.join(data_path, 'test-eve.fif')
+proj_fname = op.join(data_path, 'test_proj.fif')
+
+def test_find_ecg():
+ """Test find ECG peaks"""
+ raw = Raw(raw_fname)
+ events = find_ecg_events(raw, event_id=999)
+ n_events = len(events)
+ _, times = raw[0, :]
+ average_pulse = 60.0 * (times[-1] - times[0]) / n_events
+ assert 60 < average_pulse < 65
diff --git a/mne/fiff/raw.py b/mne/fiff/raw.py
index 9603c6f..f90d8e6 100644
--- a/mne/fiff/raw.py
+++ b/mne/fiff/raw.py
@@ -178,6 +178,9 @@ class Raw(dict):
if step is not None:
raise ValueError('step needs to be 1 : %d given' % step)
+ if isinstance(sel, int):
+ sel = np.array([sel])
+
if sel is not None and len(sel) == 0:
raise Exception("Empty channel list")
--
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