[FieldTrip] Getting data from a database instead of files

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Thu Jun 13 18:20:33 CEST 2019


Hi Thomas,

Sadly, removing the .trl, .channels and .dimord fields did not solve my problem. It did halve the number of warnings I get (from 8 to 4). A few quick tests showed me this came down to removing the .trl field and not the other ones.
I also get a warning about inconsistent sampleinfo, which I forgot to mention in my original email.

Warnings about not being able to detect the ‘dimord’ are typically not a problem, so no worries there. The warning about the sampleinfo being inconsistent is itself not a show-stopper, but suggests that there is something not completely correct in the numerics. This is most likely the consequence of occasional round-off errors of floating point numbers, which are really hard to beat. It could well be that this also causes the error you report.

Could it be a problem with my FT path? I had path-related errors with SPM earlier, and I ended up solving them by adding ft_defaults in my startup.m file.

Another thing I found out is that the error I get (Array dimensions must match for binary array op.) doesn't always happen at the same time. The processing counter goes up to trial 3, and then frequency somewhere between 1 and 24.  I'm not sure what this means, though.

It could be related to numeric round off errors, causing an occasional extra sample (or a dropout).

Yet, I noticed that you specified as method ’tfr’, which is code that I think is hardly used (because it’s so slow). May I suggest you to use ‘wltconvol’ instead? This is a much faster implementation of the wavelet transform, since it does not do convolution in the time domain (slow), but multiplication in the frequency domain (fast).

Best wishes,
Jan_Mathijs





Do you have any suggestions?

Thank you!

Thomas


Le lun. 3 juin 2019 à 11:35, Schoffelen, J.M. (Jan Mathijs) <jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>> a écrit :
Hi Thomas,

Thanks for your informative e-mail :).

Here's what I did:


1- Get the data for a subset of my choosing (I tried everything with a small 4-channel, 55-trials subset)

2- Put that data into a structure built as follows, adding fields that FieldTrip required:

    fsample: 1017           (I know this is weird but we're stuck with it)
   channels: [1 17 25 29]   Added to keep track of in-house bookkeeping
      label: {'Ch:1 idElectrodeSite:181'  'Ch:17 idElectrodeSite:183'  'Ch:25 idElectrodeSite:184'
              'Ch:29 idElectrodeSite:185'}  Not the right structure, but I don't have header files to get them from
      trial: {55×1 cell}    One cell per trial, with each being [chan x time]
       time: {55×1 cell}    One cell per trial, each going from -750ms to 750ms (around target onset) This includes a 250ms pad on each side.
        trl: [55×3 double]  Built from scratch as if the trials were continuous. (Inspired by the FT function that does this)
     dimord: 'chan_time'    Added by hand, can't get Fieldtrip to recognize it
 sampleinfo: [55×2 double]  The first two columns of trl


You may need to get rid of the following fields: ’trl’ ‘dimord’ and ‘channels’. Once this is done, I think you are ready to go, without warnings and errors.


3- Try to use ft_freqanalysis using the following cfg (also attached)

cfg = [];
cfg.method= 'tfr';
cfg.pad = 'nextpow2';
cfg.width = 7;
cfg.gwidth = 3;
cfg.foi = [15:1:60];
cfg.toi = 'all';

I first get the message:
the input is raw data with 4 channels and 55 trial
This would be encouraging, but then, I get the following warnings:

Warning: could not determine dimord of "trial" in: (structure shown above)
Warning: could not determine dimord of "trl" in:   (structure shown above)
...but four pairs of them.

Looking through the debugger, I found out they're given when ft_freqanalysis, calls ft_checkdata and ft_selectdata.
Are these warnings something I should be worried about, or can everything work well the way it is?
Also, how is it that FT 'could not determine dimord' when I give it one in the data structure, and it seems to understand the way it works given the message it sends at the beginning?

After the warnings, I get this:

the call to "ft_selectdata" took 16 seconds
processing trials
trial 2, frequency 32 (46.18 Hz)
Array dimensions must match for binary array op.

Error in ft_freqanalysis (line 679)
            trlcnt(1, ifoi, :) = trlcnt(1, ifoi, :) + shiftdim(double(acttboi(:)'),-1);

...which I simply don't know how to solve.


So in summary:

1- Is it possible to make FT work without using original files to get the data?


Yes!

2- If it is, what have I done wrong, and how could I make it work?

See above.


3- Are the warnings worrisome or is it just a natural consequence of trying to jerry-rig data in FT?

Not worrisome, they should go away if you do exactly as I told :).

4- Any idea on how to solve the error message I get is appreciated, but a secondary objective.

Probably it goes away.

Keep up the good work and with best wishes,
Jan-Mathijs



I attached the function I made to build the data structure in case it could help.


Thank you very much for reading this long-winded message!

Regards

Thomas Lusignan, B. Sc.
Paul Cisek's Lab
Université de Montréal
<GetFTLFP.m>_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190613/c9cb6b97/attachment-0002.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list