[FieldTrip] ft_definetrial setting trial onset at the end of triggers
Barnett, Benjy
benjy.barnett.20 at ucl.ac.uk
Thu Mar 9 14:46:25 CET 2023
Hi Team,
I’m having an issue with defining my trials in what I think is a very simple set up. I have ten events in a trial. They are just stimulus on for 250ms, then off for 100ms - 10 times. The first stimulus in the sequence has a trigger value of 1, and the rest have a trigger value of 2. The trigger is on for the duration of the stimulus.
Here is my trial definition code:
cfg = cfgS;
cfg.dataset = dataSets{d};
cfg.trialdef.eventtype = 'UPPT001';
cfg.trialdef.eventvalue = 1; % stimulus 1
cfg.trialdef.prestim = 0.5;
cfg.trialdef.poststim =4;
cfg.trialdef.nTrls = nTrls; % number of trials per block
cfg = ft_definetrial(cfg);
% get it
data = ft_preprocessing(cfg);
As you can see, I’m just using the generic trialfun_general function. However, for some reason the trials are being epoched according to the end of the first trigger, rather than the start.
Here is a plot of the issue: the blue line is the triggers over trials 2-35 in a block across time (all plotted on top one another). The purple lines are a photodiode signal that signals when the stimulus was actually presented to screen. The onset of each trial is for some reason aligned with the end of the trigger corresponding to the first stimulus. Can anyone suggest why this would be the case?
[cid:D3A1C09A-0228-43FF-80AA-44FF29170906 at lan]
One theory I have is because, for some also unknown reason, in the first trial of the block, the trigger is now negative, rather than positive (image below). Still, here the trials are epoched to start with the ed of the first trigger. Could it also have something to do with the trigger being on at the start of this trial?
[cid:376EF8BD-C85D-4BCC-A9A0-5B5CDBA7B0A9 at lan]
Finally, how can I go about aligning the triggers and the photodiode? I.e. so that the trial onset is aligned with the onset of the first photodiode signal, but also such that the triggers are shifted to align with the photodiode signal too. So that, in the end, I would end up with data that had the first stimulus’ onset at time point 0, and triggers that corresponded to the exact time the stimulus was shown, as measured by the photodiode.
I appreciate all your help and wisdom :)
Benjy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230309/966bcedd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image (2).png
Type: image/png
Size: 35500 bytes
Desc: image (2).png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230309/966bcedd/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image (3).png
Type: image/png
Size: 25270 bytes
Desc: image (3).png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230309/966bcedd/attachment-0001.png>
More information about the fieldtrip
mailing list