[med-svn] [python-mne] 36/52: ENH : adding pick_types_evoked function

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:23:48 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 b91de338b4e018589ac2766a00ad6116f4d8c07c
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Fri Oct 21 14:31:37 2011 -0400

    ENH : adding pick_types_evoked function
---
 mne/fiff/__init__.py |  2 +-
 mne/fiff/pick.py     | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/mne/fiff/__init__.py b/mne/fiff/__init__.py
index 906d1cc..500c463 100644
--- a/mne/fiff/__init__.py
+++ b/mne/fiff/__init__.py
@@ -10,6 +10,6 @@ from .open import fiff_open
 from .evoked import Evoked, read_evoked, write_evoked
 from .raw import Raw, read_raw_segment, read_raw_segment_times, \
                  start_writing_raw, write_raw_buffer, finish_writing_raw
-from .pick import pick_types, pick_channels
+from .pick import pick_types, pick_channels, pick_types_evoked
 from .compensator import get_current_comp
 from .proj import compute_spatial_vectors
diff --git a/mne/fiff/pick.py b/mne/fiff/pick.py
index 5042c8d..5be64dd 100644
--- a/mne/fiff/pick.py
+++ b/mne/fiff/pick.py
@@ -194,7 +194,7 @@ def pick_channels_evoked(orig, include=[], exclude=[]):
 
     Returns
     -------
-    res : dict
+    res : instance of Evoked
         Evoked data restricted to selected channels. If include and
         exclude are None it returns orig without copy.
     """
@@ -221,6 +221,50 @@ def pick_channels_evoked(orig, include=[], exclude=[]):
     return res
 
 
+def pick_types_evoked(orig, meg=True, eeg=False, stim=False, eog=False,
+                      ecg=False, emg=False, misc=False, include=[],
+                      exclude=[]):
+    """Pick by channel type and names from evoked data
+
+    Parameters
+    ----------
+    info : dict
+        The measurement info
+    meg : bool or string
+        If True include all MEG channels. If False include None
+        If string it can be 'mag' or 'grad' to select only gradiometers
+        or magnetometers. It can also be 'ref_meg' to get CTF
+        reference channels.
+    eeg : bool
+        If True include EEG channels
+    eog : bool
+        If True include EOG channels
+    ecg : bool
+        If True include ECG channels
+    emg : bool
+        If True include EMG channels
+    stim : bool
+        If True include stimulus channels
+    misc : bool
+        If True include miscellaneous analog channels
+    include : list of string
+        List of additional channels to include. If empty do not include any.
+
+    exclude : list of string
+        List of channels to exclude. If empty do not include any.
+
+    Returns
+    -------
+    res : instance of Evoked
+        Evoked data restricted to selected channels. If include and
+        exclude are None it returns orig without copy.
+    """
+    sel = pick_types(orig.info, meg, eeg, stim, eog, ecg, emg, misc, include,
+                     exclude)
+    include_ch_names = [orig.ch_names[k] for k in sel]
+    return pick_channels_evoked(orig, include_ch_names)
+
+
 def pick_channels_forward(orig, include=[], exclude=[]):
     """Pick channels from forward operator
 

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