[med-svn] [python-mne] 261/353: TST : better tests in stim artifact
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:25:11 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 a3d41d41ee1907ec51cc0da2fe054c45b25f2c3a
Author: Daniel Strohmeier <daniel.strohmeier at googlemail.com>
Date: Thu Jul 12 19:00:41 2012 +0200
TST : better tests in stim artifact
---
mne/artifacts/stim.py | 2 +-
mne/artifacts/tests/test_stim.py | 13 ++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/mne/artifacts/stim.py b/mne/artifacts/stim.py
index 01af320..0bdabcb 100644
--- a/mne/artifacts/stim.py
+++ b/mne/artifacts/stim.py
@@ -5,7 +5,7 @@ from scipy import signal, interpolate
def eliminate_stim_artifact(raw, events, event_id, tmin=-0.005,
tmax=0.01, mode='linear'):
"""Eliminates stimulations artifacts from raw data
-
+
The raw object will be modified in place (no copy)
Parameters
diff --git a/mne/artifacts/tests/test_stim.py b/mne/artifacts/tests/test_stim.py
index 8cbdc85..3a6827d 100644
--- a/mne/artifacts/tests/test_stim.py
+++ b/mne/artifacts/tests/test_stim.py
@@ -1,4 +1,5 @@
import os.path as op
+import numpy as np
from nose.tools import assert_true
from numpy.testing import assert_array_almost_equal
@@ -16,6 +17,16 @@ def test_find_ecg():
"""Test eliminate stim artifact"""
raw = Raw(raw_fname, preload=True)
events = read_events(event_fname)
- n_events = len(events)
+ event_idx = np.where(events[:, 2] == 1)[0][0]
+ tidx = events[event_idx, 0] - raw.first_samp
+
raw = eliminate_stim_artifact(raw, events, event_id=1, tmin=-0.005,
tmax=0.01, mode='linear')
+ data, times = raw[:, tidx - 3:tidx + 5]
+ diff_data0 = np.diff(data[0])
+ diff_data0 -= np.mean(diff_data0)
+ assert_array_almost_equal(diff_data0, np.zeros(len(diff_data0)))
+ raw = eliminate_stim_artifact(raw, events, event_id=1, tmin=-0.005,
+ tmax=0.01, mode='window')
+ data, times = raw[:, tidx:tidx + 1]
+ assert_true(np.all(data) == 0.)
--
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