[med-svn] [python-mne] 247/353: TST: add test on morlet

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:25:08 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 3e4e5a4a53f803822fa2693d86601a2188c5296f
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Mon Jul 9 20:54:33 2012 +0200

    TST: add test on morlet
---
 mne/time_frequency/tests/test_tfr.py | 12 +++++++++++-
 mne/time_frequency/tfr.py            |  1 -
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/mne/time_frequency/tests/test_tfr.py b/mne/time_frequency/tests/test_tfr.py
index ca4b34f..24ceeb5 100644
--- a/mne/time_frequency/tests/test_tfr.py
+++ b/mne/time_frequency/tests/test_tfr.py
@@ -5,13 +5,23 @@ from nose.tools import assert_true
 
 from ... import fiff, Epochs, read_events
 from ...time_frequency import induced_power, single_trial_power
-from ...time_frequency.tfr import cwt_morlet
+from ...time_frequency.tfr import cwt_morlet, morlet
 
 raw_fname = op.join(op.dirname(__file__), '..', '..', 'fiff', 'tests', 'data',
                 'test_raw.fif')
 event_fname = op.join(op.dirname(__file__), '..', '..', 'fiff', 'tests', 'data',
                 'test-eve.fif')
 
+
+def test_morlet():
+    """Test morlet with and without zero mean"""
+    Wz = morlet(1000, [10], 2., zero_mean=True)
+    W = morlet(1000, [10], 2., zero_mean=False)
+
+    assert_true(np.abs(np.mean(np.real(Wz[0]))) < 1e-5)
+    assert_true(np.abs(np.mean(np.real(W[0]))) > 1e-3)
+
+
 def test_time_frequency():
     """Test time frequency transform (PSD and phase lock)
     """
diff --git a/mne/time_frequency/tfr.py b/mne/time_frequency/tfr.py
index c3eb4fd..a0c431e 100644
--- a/mne/time_frequency/tfr.py
+++ b/mne/time_frequency/tfr.py
@@ -71,7 +71,6 @@ def morlet(Fs, freqs, n_cycles=7, sigma=None, zero_mean=False):
             real_offset = np.exp(- 2 * (np.pi * f * sigma_t) ** 2)
             oscillation -= real_offset
         W = oscillation * gaussian_enveloppe
-        # zero mean the wavelet (required)
         W /= sqrt(0.5) * linalg.norm(W.ravel())
         Ws.append(W)
     return Ws

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