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 d3cfc4fa7e3b8493d5339974e79ccf15ff064730 Author: Daniel Strohmeier <[email protected]> Date: Fri Jul 13 09:06:03 2012 +0200 added check if preloaded is true --- mne/artifacts/stim.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mne/artifacts/stim.py b/mne/artifacts/stim.py index 9a5d876..218611b 100644 --- a/mne/artifacts/stim.py +++ b/mne/artifacts/stim.py @@ -3,7 +3,6 @@ from scipy import signal, interpolate from ..fiff import pick_types - def eliminate_stim_artifact(raw, events, event_id, tmin=-0.005, tmax=0.01, mode='linear'): """Eliminates stimulations artifacts from raw data @@ -32,6 +31,10 @@ def eliminate_stim_artifact(raw, events, event_id, tmin=-0.005, raw: Raw object raw data object """ + if not raw._preloaded: + raise RuntimeError('Modifying data of Raw is only supported ' + 'when preloading is used. Use preload=True ' + '(or string) in the constructor.') events_sel = (events[:, 2] == event_id) event_start = events[events_sel, 0] s_start = np.ceil(raw.info['sfreq'] * np.abs(tmin))[0] @@ -46,13 +49,13 @@ def eliminate_stim_artifact(raw, events, event_id, tmin=-0.005, for k in range(len(event_start)): first_samp = event_start[k] - raw.first_samp - s_start last_samp = event_start[k] - raw.first_samp + s_end - data = raw[picks, first_samp:last_samp] + data, _ = raw[picks, first_samp:last_samp] if mode == 'linear': x = np.array([first_samp, last_samp]) - f = interpolate.interp1d(x, data[0][:, [0, -1]]) + f = interpolate.interp1d(x, data[:, [0, -1]]) xnew = np.arange(first_samp, last_samp) interp_data = f(xnew) raw[picks, first_samp:last_samp] = interp_data elif mode == 'window': - raw[picks, first_samp:last_samp] = data[0] * window[np.newaxis, :] + raw[picks, first_samp:last_samp] = data * window[np.newaxis, :] return raw -- 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
