This is an automated email from the git hooks/post-receive script. yoh pushed a commit to annotated tag v0.1 in repository python-mne.
commit 419ae64a59c2c390add6119be314608051f72b32 Author: Alexandre Gramfort <[email protected]> Date: Wed Mar 30 23:17:20 2011 -0400 FIX : keeping only data channels when averaging --- examples/stats/plot_cluster_1samp_test_time_frequency.py | 2 +- mne/epochs.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/examples/stats/plot_cluster_1samp_test_time_frequency.py b/examples/stats/plot_cluster_1samp_test_time_frequency.py index 8290ffa..6807948 100644 --- a/examples/stats/plot_cluster_1samp_test_time_frequency.py +++ b/examples/stats/plot_cluster_1samp_test_time_frequency.py @@ -52,7 +52,7 @@ picks = fiff.pick_types(raw.info, meg='grad', eeg=False, eog=True, # Load condition 1 event_id = 1 epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks, - baseline=(None, 0), reject(grad=4000e-13, eog=150e-6)) + baseline=(None, 0), reject=dict(grad=4000e-13, eog=150e-6)) data = epochs.get_data() # as 3D matrix data *= 1e13 # change unit to fT / cm # Time vector diff --git a/mne/epochs.py b/mne/epochs.py index b149396..916ef57 100644 --- a/mne/epochs.py +++ b/mne/epochs.py @@ -7,7 +7,7 @@ import copy import numpy as np import fiff from .fiff import Evoked -from .fiff.pick import channel_type +from .fiff.pick import channel_type, pick_types class Epochs(object): @@ -351,4 +351,17 @@ class Epochs(object): evoked.nave = n_events evoked.first = - np.sum(self.times < 0) evoked.last = np.sum(self.times > 0) + + # dropping EOG, ECG and STIM channels. Keeping only data + data_picks = pick_types(evoked.info, meg=True, eeg=True, + stim=False, eog=False, ecg=False, + emg=False) + if len(data_picks) == 0: + raise ValueError('No data channel found when averaging.') + + evoked.info['chs'] = [evoked.info['chs'][k] for k in data_picks] + evoked.info['ch_names'] = [evoked.info['ch_names'][k] + for k in data_picks] + evoked.info['nchan'] = len(data_picks) + evoked.data = evoked.data[data_picks] return evoked -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
