Closed agramfort closed 11 years ago
This should be pretty straightforward. I can give it a shot soon if nobody else is on it.
My first thought is to implement this in the epoch reading step, prior to decimation. That way it will work regardless of preloading. I'd probably first make a detrend function in filter (that intelligently wraps to scipy), then call that in epochs.py and evoked.py.
If this doesn't make things slow, this sounds like a good idea to me.
On Tue, Jan 8, 2013 at 4:23 PM, Eric89GXL notifications@github.com wrote:
My first thought is to implement this in the epoch reading step, prior to decimation. That way it will work regardless of preloading. I'd probably first make a detrend function in filter (that intelligently wraps to scipy), then call that in epochs.py and evoked.py.
— Reply to this email directly or view it on GitHubhttps://github.com/mne-tools/mne-python/issues/349#issuecomment-12001295.
IIRC first-order polynomial fits should have a closed-form linear algebra solution (a couple matrix multiplies / inverses), so it should be pretty quick. I guess we'll find out...
PR coming shortly on this...
see:
http://mailman.science.ru.nl/pipermail/fieldtrip/2012-January/004666.html
Epochs(..., detrend=None) -> no detrend Epochs(..., detrend=0) -> DC offset Epochs(..., detrend=1) -> order 1 polynomial correction
see scipy.signal.detrend