[FieldTrip] ?==?utf-8?q? ?==?utf-8?q? ?= redefining data se

Martin Rosenfelder martin.rosenfelder at uni-ulm.de
Thu Jan 17 11:14:15 CET 2019


Hi Stephen,

I now managed to add the event column to my .trl field. This is now a (120x4) matrix. When calling ft_preprocessing, it automatically creates the .trialinfo field. Surprisingly, this .trialinfo matrix is now only a (1x120) matrix instead of a (4x120) matrix and it contains solely the event values. The start/end/offset samples are missing. At the moment I don't have any disadvantages from that, but I don't know if this will turn out to be problematic.

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 
 
Am Mittwoch, 16. Januar 2019 17:35 CET, Stephen Whitmarsh <stephen.whitmarsh at gmail.com> schrieb: 
 
> Hi Martin,
> 
> If I understand correctly: If you add columns* to your .trl field* (so
> after the first 3 that define start/end/offset samples) which you feed into
> ft_preprocessing, ft_preprocessing will create the .trialinfo field for
> you, which should track through your analyses.
> 
> Cheers,
> Stephen
> 
> On Wed, 16 Jan 2019 at 17:15, Martin Rosenfelder <
> martin.rosenfelder at uni-ulm.de> wrote:
> 
> > Hi Stephen,
> >
> > Exactly, preferably, the events should be single values in a struct array
> > or a cell array.
> > This can then be added to the existing trial array. So far so good.
> >
> > However, my dataset misses a .trialinfo field after calling
> > ft_preprocessing, to which I could add the cell array with the condition
> > labels.
> > I then added the array with the condition labels to 'mydataset.trial'.
> > Unfortunately, this seems to confuse the ft_rejectvisual I call afterwards
> > for artifact rejection.
> > Do I have to create the .trialinfo-field by hand to my dataset?
> >
> > 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
> >
> > Am Dienstag, 15. Januar 2019 17:40 CET, Stephen Whitmarsh <
> > stephen.whitmarsh at gmail.com> schrieb:
> >
> > > Hi Martin,
> > >
> > > No indeed, your conditions/RT/events should indeed be (re)coded as single
> > > values. This also makes selecting trials etc. much easier with logical
> > > expressions, e.g. you can then simply do cfg.trials =
> > (data.trialinfo(:,1)
> > > == 3 && data.trialinfo(:,2) > 0.5, where the first column e.g. is your
> > > condition, and the second RT, to just give an example.
> > >
> > > Cheers,
> > > Stephen
> > >
> > > On Tue, 15 Jan 2019 at 17:35, Martin Rosenfelder <
> > > martin.rosenfelder at uni-ulm.de> wrote:
> > >
> > > > Dear Stephen,
> > > >
> > > > Thank you very much for the hint on ft_selectdata.
> > > >
> > > > I tried to build the structure for .trialinfo as you described it in
> > your
> > > > reply. I did this creating a structure array with the eventvalues as
> > > > elements.
> > > > Then I concatenated the .trl matrix and the event value matrix. This
> > > > however failed, since .trl is a double array and the event value
> > matrix is
> > > > a struct array.
> > > > I double-checked that the nr. of rows in the two matrices match each
> > other
> > > > (120 elements).
> > > >
> > > > Is there a way to add the event value matrix (120x1 struct) to the .trl
> > > > matrix (120x3 double)?
> > > >
> > > > 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
> > > >
> > > > Am Montag, 14. Januar 2019 19:01 CET, Stephen Whitmarsh <
> > > > stephen.whitmarsh at gmail.com> schrieb:
> > > >
> > > > > Dear Martin,
> > > > >
> > > > > Use ft_selectdata instead of ft_redefinetrial.
> > > > >
> > > > >
> > > >
> > "cfg.previous.previous.previous{1,1}.previous.previous.trialdef.eventvalue(1,2)"
> > > > > is scary! And I can imagine very inconvenient, as it will move
> > deeper and
> > > > > deeper in to infinite previousnessness.
> > > > > Instead, one of the best 'easter eggs' (i.e. not so well-documented
> > > > > functionality) of FieldTrip is to create extra columns of info in
> > your
> > > > .trl
> > > > > when using preprocessing to epoch your data. These extra columns will
> > > > then
> > > > > enter into a field .trialinfo of your data. Most if not all
> > functions,
> > > > such
> > > > > as ft_selectdata (selecting trials) will update that field. So I
> > advice
> > > > you
> > > > > to put your eventvalue (as well as RT, response, etc. etc.) as
> > columns in
> > > > > your trialinfo (so same nr. of rows as your nr. of trials). In this
> > way,
> > > > > they will travel with your data, and stay in the same structure and
> > on
> > > > the
> > > > > same level whatever happens.
> > > > >
> > > > > Cheers,
> > > > > Stephen
> > > > >
> > > > >
> > > > > On Mon, 14 Jan 2019 at 18:47, Martin Rosenfelder <
> > > > > martin.rosenfelder at uni-ulm.de> wrote:
> > > > >
> > > > > > Dear Fieldtrip community,
> > > > > >
> > > > > > I have preprocessed a single dataset with two different conditions
> > > > > > ('Swim', 'Rest'). The conditions are stored in the 'eventvalue'
> > field
> > > > of
> > > > > > the cfg as 1x2 cell array. The event values are stored in the
> > > > > >
> > > >
> > 'data_ref.cfg.previous.previous.previous{1,1}.previous.previous.trialdef.eventvalue'
> > > > > > field of the data set.
> > > > > > Having done the preprocessing I now would like to do
> > > > ft_timelockanalysis
> > > > > > and ft_freqanalysis on the data. Afterwards I statistically compare
> > > > the two
> > > > > > conditions using ft_timelockstatistics and ft_freqstatistics.
> > > > > > How can I split the data set according to the event values ('Swim',
> > > > > > 'Rest')? I need the event values to split the data set into the two
> > > > trial
> > > > > > classes in the ft_timelockanalysis / ft_freqanalysis and to compare
> > > > these
> > > > > > two conditions.
> > > > > >
> > > > > > I tried ft_redefinetrial, but do not know how to define the
> > cfg.trials
> > > > > > field of this function.
> > > > > >
> > > > > >          % trial redefinition
> > > > > >
> > > > > >         % containing only trials in the 'swim' condition
> > > > > >          cfg.trials = (1,
> > > > > >
> > > >
> > data_ref.cfg.previous.previous.previous{1,1}.previous.previous.trialdef.eventvalue(1,1));
> > > > > >          swim = ft_redefinetrial(cfg,data_ref);
> > > > > >
> > > > > >         % containing only trials in the 'resting' condition
> > > > > >          cfg.trials = (1,
> > > > > >
> > > >
> > data_ref.cfg.previous.previous.previous{1,1}.previous.previous.trialdef.eventvalue(1,2));
> > > > > >          rest = ft_redefinetrial(cfg,data_ref);
> > > > > >
> > > > > > I hope the description was quite clear. In case, I can provide some
> > > > more
> > > > > > lines of code to clarify the issue.
> > > > > >
> > > > > > Thank you very much in advance for your advice!
> > > > > >
> > > > > > Best regards,
> > > > > > 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
> > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > 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
> >
 
 






More information about the fieldtrip mailing list