[FieldTrip] Fwd: Getting data from a database instead of files

Thomas Lusignan thomas.lusignan at gmail.com
Mon Jun 3 17:00:42 CEST 2019


Hi everyone,

I'm Thomas, a Master's student in Paul Cisek's lab at Université de
Montréal, Canada, and also a FieldTrip newbie. My project is to analyse LFP
data from chronically implanted electrodes
<https://www.graymatter-research.com/32-channel-microdrive-system-sc32/> in
monkeys during a decision-making task. FieldTrip seems to be the best, most
complete tool for this job. However.

Since we have years worth of data, we have everything stored and organized
(with extensive bookkeeping) in an SQL database and have an in-house
toolbox to get it into MATLAB. This means using the original files created
every day is counter-productive in my situation. Therefore, I have tried to
create a data structure that would work with FT functions by getting data
from our database, however FieldTrip seems to *really* want to get its data
from files.

Has using self-made data structures ever been done? *Can* it be done?

In time, I would like to use as many FieldTrip functions as is applicable,
but I tried to start by using ft_freqanalysis to get time-frequency
representations. Here's


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



*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?
2- If it is, what have I done wrong, and how could I make it work?
3- Are the warnings worrisome or is it just a natural consequence of trying
to jerry-rig data in FT?
4- Any idea on how to solve the error message I get is appreciated, but a
secondary objective.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190603/a5c8b42e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GetFTLFP.m
Type: text/x-objcsrc
Size: 3745 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190603/a5c8b42e/attachment-0001.bin>
-------------- 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