[FieldTrip] modification in newest version ft_redefinetrial

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Wed Sep 22 16:54:30 CEST 2021


Dear Andreas,

This is truly a lightspeed pick up of some new functionality that only came available this morning!

I think that there may be some confusion w.r.t. the meaning of the option ‘continuous’ in ft_preprocessing vs. ft_redefinetrial, and perhaps also with respect to when to use ft_definetrial or ft_redefinetrial.

Clearly, ft_definetrial is intended to decorate the input cfg structure with a ’trl’ field, which is the recipe for the epochs.

cfg.continuous is an option for ft_preprocessing to be able to deal with CTF’s ‘pseudocontinuous’ recording mode, which essentially means that every 10 seconds or so (in a continuous data stream) a ’trial’ trigger is inserted in the data, which caused the original reading functions to choke if samples across these artificial boundaries were detected.

on the other hand, cfg.continuous in ft_redefinetrial has a different meaning and functionality. It is intended as a recipe to ’stitch back together’ chunks of data, that before for some reason became unstitched. There are not many exotic use cases that would need this, and it is even dangerous to apply this option too enthusiastically, but the typical use case would be something like this:

cfg = [];
cfg = <somedataset>
data = ft_preprocessing(cfg); %->reads in the data as a very long chunk

cfg = [];
cfg.length = 2;
data = ft_redefinetrial(cfg, data); %-> chops up the data in 1 s snippets

cfg = [];
cfg.method = ’summary’;
cfg.keeptrial = ’nan’;
data = ft_rejectvisual(cfg, data); %-> results in chunked data with ‘artifiacts’ nanned out

cfg = [];
cfg.continuous = ‘yes’;
data = ft_redefinetrial(cfg, data); %-> stitches everything back together again, but now with NaNs at the one-second windows containing artifacts

As an important side note: This is risky once you start filtering the individual chunks before you stitch them together again, because you introduce boundary effects, which were not there
initially.


Using cfg.trl in ft_redefinetrial, where the input data typically contains one (or a few) very long segments of data should not require the cfg.continuous option to be specified, not even if this was needed for ft_preprocessing in the first place. My suspicion is that you stumbled across this because of what I just said, so the solution to your problem is to start from an empty cfg before calling ft_redefinetrial (and not recycle the one you also used for ft_preprocessing).
Please let me know if I totally ‘missed the plank’, as we’d say in Dutch.

Best wisehs,
JM






On 22 Sep 2021, at 15:55, Andreas Wollbrink via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear Fieldtrip community,

my question is probably more directed to the Fieldtrip developers, but
should be of interest to the rest of the users as well.
I just noticed that in the latest Fieldtrip version (revision
0cafbf72b) in the function ft_redefinetrial in line 156 there are some
plausibility queries that exclude the mutual presence of cfg.trl and
cfg.continuous.
Can't this make sense if cfg.trl is obtained from a previous call to
ft_definetrial and the data itself was recorded continuously?
What is the recommendation then on how to call the ft_redefinetrial
function?

Thanks a lot for the help.

Best, Andreas

--
Andreas Wollbrink,
Dipl.-Ing., Biomedical Engineer

MEG / EEG Lab Manager

Institute for Biomagnetism and Biosignalanalysis
University Hospital, University of Muenster

Malmedyweg 15, 48149 Muenster, Germany

office:    +49-251-83-52546
email: a.wollbrink at wwu.de<mailto:a.wollbrink at wwu.de>

https://urldefense.com/v3/__http://campus.uni-muenster.de/biomag/das-institut/mitarbeiter/andreas-wollbrink__;!!HJOPV4FYYWzcc1jazlU!pjFq8SOuM1EcP-viSP-nhi5lt4TLaOCmAUl1HEjHVL4ssvU8EBe0uhO5IVxTK5ayqoDhyxMFREo5cf8$



_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!pjFq8SOuM1EcP-viSP-nhi5lt4TLaOCmAUl1HEjHVL4ssvU8EBe0uhO5IVxTK5ayqoDhyxMFGVnECC8$

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


More information about the fieldtrip mailing list