[FieldTrip] ?= ft appendspike create a trialfun for continuos dat

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Tue Feb 19 15:04:51 CET 2019


Maria,

Can I reiterate my suggestion to look into the problem at the level of ft_appendspike (as per the text copied in below), or additionally look into this information: http://www.fieldtriptoolbox.org/faq/how_can_i_import_my_own_dataformat/

Your ‘vicious’ circle is caused by the fact that you try to create a ’trl’-matrix using an underdefined data format, so I don’t think that this is going to work.

Best wishes,
Jan-Mathijs


J.M.Schoffelen, MD PhD
Senior Researcher, VIDI-fellow - PI, language in interaction
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Hi Maria,

I am not using combined spike/lfp data myself, but I suggest that you look into the code of ft_appendspike in a little more detail. This will give you some idea about why the error occurs.

My initial thought is that ft_appendspike hasn’t matured (in terms of backward compatibility) along with the fieldtrip code base (and more strict internal data representation). Any improvements in the code will therefore be most welcome. I suspect that the current issue results from the fact that the code tries to look into data.cfg. … .trl to extract information about the original sampling. Since your data is coming from somewhere else, this information is not present. Also, current data organization standards actually prohibit to look into data.cfg.previous. … trl, and require this information be represented in a field called .sampleinfo.

I suggest that you search in the documentation for ‘sampleinfo’ to get an impression how this information is used throughout the code, and how it is generated if it doesn’t exist (hint: use ft_checkdata(data,'hassampleinfo’, true);

Please also, if you have fixed your version of ft_appendspike, do submit a Pull Request on github so that we can incorporate your fixes into the codebase.

Best wishes
Jan-Mathijs


On 19 Feb 2019, at 14:47, María Alejandra Korovaichuk <alejandra.korovaichuk at ctb.upm.es<mailto:alejandra.korovaichuk at ctb.upm.es>> wrote:

Yes, I've been going through that discussion trying to repeat what Rachel did but is not working, maybe my problem is somewhere else.
I want to use the ft_appendspike function in order to do a spike-field coherence test. So, to do that the FT tutorial says I need to process the raw spike data such the resulting spike structure has the "same trial definition" as the lfp structure.
Al lthe time in the tutorial is asking me for a trl function but the only way to create a trl matrix is using the ft_definitiontria, and to use the ft_definitiontrial I need to read the header.
Is a vicious circle and I can't find the way out

El mar., 19 feb. 2019 a las 14:29, Martin Rosenfelder (<martin.rosenfelder at uni-ulm.de<mailto:martin.rosenfelder at uni-ulm.de>>) escribió:
Dear Alex,

I suppose that Fieldtrip throws that particular error, since the data is already present in MATLAB structure. Actually, I think there is no need to define the trial using ft_definetrial. Maybe ft_redifinetrial accepts the MATLAB structure of your data. Does reading the data as 'continuous' work using ft_preprocessing?
See also the following link to a similar problem which had been discussed in the Fieldtrip community three years ago:
https://mailman.science.ru.nl/pipermail/fieldtrip/2016-July/010699.html

Best,
Martin


--
M.Sc.-Psych. Martin Rosenfelder
Wissenschaftlicher Mitarbeiter
Klinische und Biologische Psychologie
Universität Ulm
Raum 47.2.259
+49 731-50 26592
martin.rosenfelder at uni-ulm.de<mailto:martin.rosenfelder at uni-ulm.de>

Am Dienstag, 19. Februar 2019 12:52 CET, María Alejandra Korovaichuk <alejandra.korovaichuk at ctb.upm.es<mailto:alejandra.korovaichuk at ctb.upm.es>> schrieb:

> Thanks Martin, but I tried this many times before and is still the same
> issue.
> FT is not recognizing mydata (is a matlab file with 3 variables: time (in
> milliseconds), lfp data (in mV), and sampling freq
>
> The message is always the same:
> evaluating trialfunction 'ft_trialfun_general'
> reading the header from 'mydata.mat'
> Error using ft_read_header (line 2581)
> unsupported header format "matlab"
>
>
>
> El mar., 19 feb. 2019 a las 11:44, Martin Rosenfelder (<
> martin.rosenfelder at uni-ulm.de<mailto:martin.rosenfelder at uni-ulm.de>>) escribió:
>
> > Hi Alex,
> >
> > You can use the ft_definetrial function in order to define your data
> > containing continuous data. In order to achieve this, you can specify the
> > cfg like this:
> > cfg = []
> > cfg.trialdef = (your 1x3 matrix)
> > data_new = ft_definetrial(data)
> >
> > The new variable should now contain your continuous data as one trial.
> > In the new data matrix you can then check the .trl field if it really
> > consists of just one trial from beginning to end of your timeline.
> >
> > Maybe this works.
> >
> > Best,
> > Martin
> >
> >
> >
> >
> > --
> > M.Sc.-Psych. Martin Rosenfelder
> > Wissenschaftlicher Mitarbeiter
> > Klinische und Biologische Psychologie
> > Universität Ulm
> > Raum 47.2.259
> > +49 731-50 26592
> > martin.rosenfelder at uni-ulm.de<mailto:martin.rosenfelder at uni-ulm.de>
> >
> > Am Dienstag, 19. Februar 2019 10:19 CET, María Alejandra Korovaichuk <
> > alejandra.korovaichuk at ctb.upm.es<mailto:alejandra.korovaichuk at ctb.upm.es>> schrieb:
> >
> > > Hi!
> > >
> > > Is still impossible to use the appendspike function in my data :( That is
> > > way  now I am trying to use the ft_definetrial to create my own set.
> > > My question is how can I create a trialfun for continuos data (that
> > means I
> > > don't want to split my data into segments or events or epochs), I want to
> > > define a long and continuos set of data (the LFP), in order to append the
> > > spike data afterwards.
> > >
> > > Thanks!
> > >
> > > Best,
> > >
> > > Alex
> >
> >
> >
> >
> > _______________________________________________
> > 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/20190219/cec4cfc3/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