Back to the main page.

Bug 2140 - discrepancy between trials/time when filtering in-memory trials with mirror padding

Status CLOSED FIXED
Reported 2013-04-26 11:57:00 +0200
Modified 2014-03-12 12:21:33 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P3 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

Robin - 2013-04-26 11:57:07 +0200

Is it possible filter in-memory extracted trials data with mirroring at the edges? When I try: % filter cfg = [];cfg.lpfilter = 'yes'; cfg.lpfreq = '40'; cfg.lpfilttype ='but'; cfg.padtype = 'mirror'; % trial length is 1.1s so mirror-pad to1.5s (200ms each side) cfg.padding = 1.5; flt_data = ft_preprocessing(cfg, block_data); I get: Reference to non-existent field 'Fs'. Error in ft_preprocessing (line 288) padding = round(cfg.padding * data.Fs); Adding block_data.Fs = block_data.fsample; seems to work. But in the resulting data structure the time vectors no longer match the trial data, so obviously something is going wrong: >> size(block_data.time{1}) ans = 1 560 >> size(block_data.trial{1}) ans = 234 560 >> size(flt_data.trial{1}) ans = 234 560 >> size(flt_data.time{1}) ans = 1 357 This is using SVN r8075. block_data is the result of ft_appenddata of several individual runs.


Jörn M. Horschig - 2013-04-26 12:26:37 +0200

Created attachment 468 corrected for in-memory data - is this correct for data on disk as well? Hi Robin, in the meanwhile I found that the error is because the number of padded samples also get deducted from the time-axis, while time-axis did not get padded. So that was an easy fix, see attachment. I just wonder whether the same fix that I applied for data in memory has to be applied for data on disk. The attached version applies the same fix for data on disk, but I am not sure whether this is the correct thing to do. I will still have to do some sanity checks for this. However, your bug should be fixed with this version.


Jörn M. Horschig - 2013-06-12 16:25:19 +0200

Hi Robin, whoops, I thought this was fixed, but I just checked and realized it is not. I fixed all this padding stuff now, should work in the version from tomorrow onwards. Sorry for the long delay. http://code.google.com/p/fieldtrip/source/detail?r=8246 Best, Jörn