Back to the main page.

Bug 1389 - cfg.preproc uneffective

Status CLOSED WORKSFORME
Reported 2012-03-23 14:27:00 +0100
Modified 2012-04-02 16:26:10 +0200
Product: FieldTrip
Component: preproc
Version: unspecified
Hardware: All
Operating System: All
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

n.barascud@ucl.ac.uk - 2012-03-23 14:27:10 +0100

The following code : cfg.demean = 'yes'; cfg.baselinewindow = [-.2 0];% in seconds cfg.hpfilter ='yes'; cfg.hpfreq = 1; cfg.lpfilter ='yes'; cfg.lpfreq = 30; data = ft_preprocessing(cfg); Works but gives the following warnings : Warning: The field cfg.demean is deprecated, please specify it as cfg.preproc.demean instead of cfg. > In ft_checkconfig at 438 In ft_rejectvisual at 229 Warning: The field cfg.baselinewindow is deprecated, please specify it as cfg.preproc.baselinewindow instead of cfg. > In ft_checkconfig at 438 In ft_rejectvisual at 229 Warning: The field cfg.hpfilter is deprecated, please specify it as cfg.preproc.hpfilter instead of cfg. > In ft_checkconfig at 438 In ft_rejectvisual at 229 Warning: The field cfg.hpfreq is deprecated, please specify it as cfg.preproc.hpfreq instead of cfg. > In ft_checkconfig at 438 In ft_rejectvisual at 229 Warning: The field cfg.lpfilter is deprecated, please specify it as cfg.preproc.lpfilter instead of cfg. > In ft_checkconfig at 438 In ft_rejectvisual at 229 Warning: The field cfg.lpfreq is deprecated, please specify it as cfg.preproc.lpfreq instead of cfg. > In ft_checkconfig at 438 In ft_rejectvisual at 229 However, the following code just does nothing (data not filtered, not baseline-corrected) : cfg.preproc.demean = 'yes'; cfg.preproc.baselinewindow = [-.2 0];% in seconds cfg.preproc.hpfilter ='yes'; cfg.preproc.hpfreq = 1; cfg.preproc.lpfilter ='yes'; cfg.preproc.lpfreq = 30; data = ft_preprocessing(cfg); This happens on my machine (OSX) using the latest FT version (from svn), and has been reported to be replicable on Windows machines as well.


Jan-Mathijs Schoffelen - 2012-03-23 15:34:05 +0100

Hi Nicolas, Sorry for the confusion, but it seems you are mixing up 2 things. The warning messages you get do not originate from your call to ft_preprocessing, but seem to originate from your call to ft_rejectvisual. So, I cannot reproduce your problem (i.e. getting the warnings) when I do cfg = []; cfg.demean = 'yes'; cfg.baselinewindow = [-.2 0]; data = ft_preprocessing(cfg, data); (or data = ft_preprocessing(cfg)) When calling a function which does some manipulation on the data, such as ft_rejectvisual, but also ft_timelockanalysis etc, it is custom to define the preprocessing parameters in the lower level structure cfg.preproc. This is what the warnings are about. In the past, people could specify these parameters at the main level of the cfg, i.e. cfg.demean = 'yes'. Currently, it is not recommended anymore (as the warnings reflect).


Jan-Mathijs Schoffelen - 2012-03-23 15:39:34 +0100

some example code attached: ok = true; data = []; data.trial{1} = randn(2,100)+10; data.time{1} = (-20:79)./100; data.label = {'1';'2'}; % this is how it should work cfg = []; cfg.demean = 'yes'; cfg.baselinewindow = [-inf 0]; data2 = ft_preprocessing(cfg, data); ok = ok && all(mean(data.trial{1},2)~=mean(data2.trial{1},2)); % this is how it shouldn't work cfg = []; cfg.preproc.demean = 'yes'; cfg.preproc.baselinewindwo = [-inf 0]; data2b = ft_preprocessing(cfg, data); ok = ok && all(mean(data.trial{1},2)==mean(data2b.trial{1},2)); % this is how it should work cfg = []; cfg.preproc.demean = 'yes'; cfg.preproc.baselinewindow = [-inf 0]; data3 = ft_timelockanalysis(cfg, data); ok = ok && all(mean(data.trial{1},2)~=mean(data3.avg,2));