Back to the main page.

Bug 3301 - padding is not executed when the padding interval is shorter than the trial's length

Status CLOSED FIXED
Reported 2017-06-03 03:02:00 +0200
Modified 2019-08-10 12:42:12 +0200
Product: FieldTrip
Component: preproc
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 major
Assigned to: Arjen Stolk
URL:
Tags:
Depends on:
Blocks:
See also:

Arjen Stolk - 2017-06-03 03:02:35 +0200

Line 526 and onwards in ft_preprocessing: nsamples = cfg.trl(i,2)-cfg.trl(i,1)+1; if nsamples>padding % the trial is already longer than the total length requested begsample = cfg.trl(i,1); endsample = cfg.trl(i,2); offset = cfg.trl(i,3); begpadding = 0; endpadding = 0; Note that begpadding and endpadding are set to 0 in case nsamples > padding. Why? As a result, no padding is used, and the user is not made aware of it.


Jan-Mathijs Schoffelen - 2017-06-03 12:38:35 +0200

This is because the value of cfg.padding is the length of the snippet that is read from disk, including the padding. Perhaps it would be an idea to add a warning indeed.


Robert Oostenveld - 2017-06-03 15:40:15 +0200

see http://www.fieldtriptoolbox.org/faq/how_does_the_filter_padding_in_preprocessing_work


Arjen Stolk - 2017-06-03 19:15:42 +0200

I see; "preprocessing parameter cfg.padding defines the duration to which the data in the trial will be padded" That was counter-intuitive indeed. The default 0 seconds suggests nothing is added to the trial and that setting it to 0.5 for instance would add half a second (on each side). Instead, the 0 value is just a switch variable for not padding. cfg.padding = 'no' as a default would be more intuitively clear. It's also not clear how to pad trials with different lengths.


Arjen Stolk - 2017-06-03 22:53:57 +0200

(In reply to Jan-Mathijs Schoffelen from comment #1) added: ft_warning('no padding applied because the padding duration is shorter than the trial'); see https://github.com/fieldtrip/fieldtrip/pull/451


Robert Oostenveld - 2019-08-10 12:35:57 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.


Robert Oostenveld - 2019-08-10 12:42:12 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.