[FieldTrip] cfg.baseline in ft_timelockbaseline

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Mon May 30 09:31:46 CEST 2022

Hi Songhee,

In order to investigate this mystery a bit, I suggest that you use the MATLAB debugger https://www.section.io/engineering-education/how-to-debug-matlab-code/ to put some breakpoints in the relevant section of ft_timelockbaseline so that you can inspect what happens in the code using the 3 different use cases you sketch.

This will give you some directions as to how to change the code (i.e. build in some checks with respect to the requested times in the cfg.baseline in relation to the time axis in your data object, and throw an appropriate warning/error if needed). Feel free to send these updates as a Pull Request https://www.fieldtriptoolbox.org/development/git/ on github.

Happy code snooping and keep up the good work,


On 25 May 2022, at 21:19, Songhee Kim via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hi FieldTrippers,

I am curious to know how cfg.baseline exactly works in ft_timelockbaseline. I have a time-locked data (i.e., datain), whose 'time' goes from -1 to 2. Now, I tried running ft_timelockbaseline with the following baseline parameters:

cfg.baseline = [-0.5 0]         intended baseline
cfg.baseline = [-3 -2]           should throw an error
cfg.baseline = [1 0]             should thrown an error I believe

But none of this threw an error. When I inspected dataout, it seems that dataout.avg is identical to datain.avg in the case of cfg.baseline = [1 0]. But in other cases, they are not identical, meaning ft_timelockbaseline() did something. My code example is below:

datain = ft_timelockanalysis(cfg, data);
cfg= []; cfg.baseline = [-0.5, 0];
dataout  = ft_timelockbaseline(cfg, datain);

Songhee Kim, PhD
Postdoctoral Fellow
Department of Neurology
Medical College of Wisconsin
fieldtrip mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220530/2ed2a687/attachment.htm>

More information about the fieldtrip mailing list