[med-svn] [python-mne] 01/02: Imported Upstream version 0.8.3+dfsg

Yaroslav Halchenko debian at onerussian.com
Sun Sep 21 22:04:05 UTC 2014


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

yoh pushed a commit to annotated tag upstream/0.8.3+dfsg
in repository python-mne.

commit 42102788a769ae584bf43bd08254abbf6bf515e6
Author: Yaroslav Halchenko <debian at onerussian.com>
Date:   Sun Sep 21 23:44:47 2014 +0200

    Imported Upstream version 0.8.3+dfsg
---
 doc/source/python_reference.rst      | 30 ++++++++++++++++++++++++++++--
 mne/__init__.py                      |  2 +-
 mne/channels.py                      |  9 +++++++--
 mne/time_frequency/__init__.py       |  1 +
 mne/time_frequency/tests/test_tfr.py | 16 ++++++++++++++++
 mne/time_frequency/tfr.py            |  5 ++++-
 6 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/doc/source/python_reference.rst b/doc/source/python_reference.rst
index 6101c43..3704cc9 100644
--- a/doc/source/python_reference.rst
+++ b/doc/source/python_reference.rst
@@ -132,7 +132,7 @@ Functions:
    get_head_surf
    get_meg_helmet_surf
    parse_config
-   read_annot
+   read_labels_from_annot
    read_bem_solution
    read_bem_surfaces
    read_cov
@@ -151,7 +151,7 @@ Functions:
    read_surface
    read_trans
    save_stc_as_volume
-   write_annot
+   write_labels_to_annot
    write_bem_surface
    write_cov
    write_events
@@ -723,7 +723,19 @@ Decoding
 
 .. automodule:: mne.decoding
    :no-members:
+   :no-inherited-members:
+
+Classes:
+
+.. autosummary::
+   :toctree: generated/
+   :template: class.rst
 
+   Scaler
+   ConcatenateChannels
+   PSDEstimator
+   FilterEstimator
+   CSP
 
 Realtime
 ========
@@ -732,6 +744,20 @@ Realtime
 
 .. automodule:: mne.realtime
    :no-members:
+   :no-inherited-members:
+
+Classes:
+
+.. autosummary::
+   :toctree: generated/
+   :template: class.rst
+
+   RtEpochs
+   RtClient
+   MockRtClient
+   FieldTripClient
+   StimServer
+   StimClient
 
 MNE-Report
 ==========
diff --git a/mne/__init__.py b/mne/__init__.py
index a2d4884..a8c5268 100644
--- a/mne/__init__.py
+++ b/mne/__init__.py
@@ -1,7 +1,7 @@
 """MNE for MEG and EEG data analysis
 """
 
-__version__ = '0.8.2'
+__version__ = '0.8.3'
 
 # have to import verbose first since it's needed by many things
 from .utils import (set_log_level, set_log_file, verbose, set_config,
diff --git a/mne/channels.py b/mne/channels.py
index 1c525fd..d50dee2 100644
--- a/mne/channels.py
+++ b/mne/channels.py
@@ -92,10 +92,11 @@ def equalize_channels(candidates, verbose=None):
     from .io.base import _BaseRaw
     from .epochs import Epochs
     from .evoked import Evoked
+    from .time_frequency import AverageTFR
 
-    if not all([isinstance(c, (_BaseRaw, Epochs, Evoked))
+    if not all([isinstance(c, (_BaseRaw, Epochs, Evoked, AverageTFR))
                 for c in candidates]):
-        valid = ['Raw', 'Epochs', 'Evoked']
+        valid = ['Raw', 'Epochs', 'Evoked', 'AverageTFR']
         raise ValueError('candidates must be ' + ' or '.join(valid))
 
     chan_max_idx = np.argmax([c.info['nchan'] for c in candidates])
@@ -175,6 +176,8 @@ class PickDropChannelsMixin(object):
         from .io.base import _BaseRaw
         from .epochs import Epochs
         from .evoked import Evoked
+        from .time_frequency import AverageTFR
+
         if isinstance(self, _BaseRaw):
             if not self.preload:
                 raise RuntimeError('Raw data must be preloaded to drop or pick'
@@ -197,6 +200,8 @@ class PickDropChannelsMixin(object):
             self._data = self._data[idx, :]
         elif isinstance(self, Epochs) and inst_has('_data'):
             self._data = self._data[:, idx, :]
+        elif isinstance(self, AverageTFR) and inst_has('data'):
+            self.data = self.data[idx, :, :]
         elif isinstance(self, Evoked):
             self.data = self.data[idx, :]
 
diff --git a/mne/time_frequency/__init__.py b/mne/time_frequency/__init__.py
index 806c44d..4e8837c 100644
--- a/mne/time_frequency/__init__.py
+++ b/mne/time_frequency/__init__.py
@@ -2,6 +2,7 @@
 """
 
 from .tfr import induced_power, single_trial_power, morlet, tfr_morlet
+from .tfr import AverageTFR
 from .psd import compute_raw_psd, compute_epochs_psd
 from .csd import CrossSpectralDensity, compute_epochs_csd
 from .ar import yule_walker, ar_raw, iir_filter_raw
diff --git a/mne/time_frequency/tests/test_tfr.py b/mne/time_frequency/tests/test_tfr.py
index 653e43a..d9497cc 100644
--- a/mne/time_frequency/tests/test_tfr.py
+++ b/mne/time_frequency/tests/test_tfr.py
@@ -3,6 +3,7 @@ import os.path as op
 from numpy.testing import assert_array_almost_equal
 from nose.tools import assert_true, assert_false, assert_equal
 
+import mne
 from mne import io, Epochs, read_events, pick_types
 from mne.time_frequency import single_trial_power
 from mne.time_frequency.tfr import cwt_morlet, morlet, tfr_morlet
@@ -51,6 +52,10 @@ def test_time_frequency():
     freqs = np.arange(6, 20, 5)  # define frequencies of interest
     n_cycles = freqs / 4.
 
+    # Test first with a single epoch
+    power, itc = tfr_morlet(epochs[0], freqs=freqs, n_cycles=n_cycles,
+                            use_fft=True, return_itc=True)
+
     power, itc = tfr_morlet(epochs, freqs=freqs, n_cycles=n_cycles,
                             use_fft=True, return_itc=True)
 
@@ -91,3 +96,14 @@ def test_time_frequency():
                                       n_cycles=2)
 
     assert_array_almost_equal(np.mean(single_power), power.data)
+
+    power_pick = power.pick_channels(power.ch_names[:10:2])
+    assert_equal(len(power_pick.ch_names), len(power.ch_names[:10:2]))
+    assert_equal(power_pick.data.shape[0], len(power.ch_names[:10:2]))
+    power_drop = power.drop_channels(power.ch_names[1:10:2])
+    assert_equal(power_drop.ch_names, power_pick.ch_names)
+    assert_equal(power_pick.data.shape[0], len(power_drop.ch_names))
+
+    mne.equalize_channels([power_pick, power_drop])
+    assert_equal(power_pick.ch_names, power_drop.ch_names)
+    assert_equal(power_pick.data.shape, power_drop.data.shape)
diff --git a/mne/time_frequency/tfr.py b/mne/time_frequency/tfr.py
index 6a16a9e..7653eed 100644
--- a/mne/time_frequency/tfr.py
+++ b/mne/time_frequency/tfr.py
@@ -386,7 +386,7 @@ def _induced_power(data, Fs, frequencies, use_fft=True, n_cycles=7,
         plf = np.empty((n_channels, n_frequencies, n_times), dtype=np.complex)
 
         for c in range(n_channels):
-            X = np.squeeze(data[:, c, :])
+            X = data[:, c, :]
             this_psd, this_plf = _time_frequency(X, Ws, use_fft)
             psd[c], plf[c] = this_psd[:, ::decim], this_plf[:, ::decim]
     else:
@@ -476,6 +476,9 @@ def _preproc_tfr(data, times, freqs, tmin, tmax, fmin, fmax, mode,
 
     freqs = freqs[ifmin:ifmax]
 
+    # crop data
+    data = data[:, ifmin:ifmax, itmin:itmax]
+
     times *= 1e3
     if dB:
         data = 20 * np.log10(data)

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