[med-svn] [python-mne] 28/52: FIX : bug fix with stc.times in apply_inverse_raw

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:23:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

yoh pushed a commit to annotated tag v0.2
in repository python-mne.

commit d4b38ce02d34367a9ac0d215f76f41d95b8bd3c9
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Tue Oct 4 20:51:44 2011 -0400

    FIX : bug fix with stc.times in apply_inverse_raw
---
 mne/minimum_norm/inverse.py            | 2 +-
 mne/minimum_norm/tests/test_inverse.py | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/mne/minimum_norm/inverse.py b/mne/minimum_norm/inverse.py
index 787155a..1898a2e 100644
--- a/mne/minimum_norm/inverse.py
+++ b/mne/minimum_norm/inverse.py
@@ -617,7 +617,7 @@ def apply_inverse_raw(raw, inverse_operator, lambda2, dSPM=True,
     if noise_norm is not None:
         sol *= noise_norm
 
-    tmin = float(times[0]) / raw.info['sfreq']
+    tmin = float(times[0])
     tstep = 1.0 / raw.info['sfreq']
     stc = _make_stc(sol, tmin, tstep, lh_vertno, rh_vertno)
     print '[done]'
diff --git a/mne/minimum_norm/tests/test_inverse.py b/mne/minimum_norm/tests/test_inverse.py
index c5545a2..8f29bac 100644
--- a/mne/minimum_norm/tests/test_inverse.py
+++ b/mne/minimum_norm/tests/test_inverse.py
@@ -38,6 +38,7 @@ snr = 3.0
 lambda2 = 1.0 / snr ** 2
 dSPM = True
 
+
 def test_inverse_operator():
     """Test MNE inverse computation
 
@@ -65,10 +66,14 @@ def test_inverse_operator():
 def test_apply_mne_inverse_raw():
     """Test MNE with precomputed inverse operator on Raw
     """
+    start = 3
+    stop = 10
+    _, times = raw[0, start:stop]
     stc = apply_inverse_raw(raw, inverse_operator, lambda2, dSPM=True,
-                            label=label, start=0, stop=10, nave=1,
+                            label=label, start=start, stop=stop, nave=1,
                             pick_normal=False)
     assert_true(np.all(stc.data > 0))
+    assert_array_almost_equal(stc.times, times)
 
 
 def test_apply_mne_inverse_epochs():
@@ -90,4 +95,3 @@ def test_apply_mne_inverse_epochs():
     assert_true(len(stcs) == 1)
     assert_true(np.all(stcs[0].data > 0))
     assert_true(np.all(stcs[0].data < 42))
-

-- 
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