If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): Win7
PsychoPy version (e.g. 1.84.x): v2022.1.3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
Hello everyone!
I’m trying to build an fMRI experiment in which a routine consists of a cue (displayed text = coloured fixation cross, 1 s), followed by the stimulus (an image, 8 s), a response window (displayed text = question mark, 4 s), and a jittered ITI (displayed text = fixation cross, duration 4 / 6 / 8 s).
What did you try to make it work?:
First attempt: At the beginning of the routine, I included a code element with
Begin Routine
ITIs = [4, 6, 8]
shuffle(ITIs)
For the ITI fixation element, I specified $ITIs[0] as a duration.
This routine is repeated several times using the Loop option.
Second attempt: Instead of this, I specified the durations for the ITIs in an Excel sheet (which is actually better as this way, I can ensure that each of the three durations are used equally often when looping through the stimuli).
What specifically went wrong when you tried that?:
The durations for the ITI turn out to be about 0.2 s longer independent of whether I go with the first or the second attempt. More specifically, the durations for the cue match the expected 1 s (e.g. 0.999914947, 1.00003996, 1.000019064, 1.000011365, 1.000016131), the durations for the stimulus match the expected 8 s (e.g. 8.00018587, 8.000067456, 8.000078821, 8.00010595, 8.000068922), the durations for the response window match the expected 4 s (e.g. 3.999994867, 4.00004326, 4.000098251, 4.000069655, 4.00006489), but the durations for the ITI do not match the expected 4 / 6 / 8 s, but are about 0.2 s longer (e.g. 4.18341439, 6.166791313, 6.250049675, 8.183504209).
Now of course, I could subtract 0.2 s from the specified durations, but this is certainly not optimal as I have no idea whether it is always ~ 0.2 s. Another solution would be to wait for a trigger from the MRI scanner at the beginning of the routines to ensure that stimulus onsets happen roughly at the same time relative to the TR from the scanner (timing is not really critical in my case, but I would nonetheless prefer the onsets to roughly align with the TR, and accumulating 0.2 s are certainly not what I would like). However, why does this deviation occur in the first place? 0.2 s also seem to be huge in my opinion.
Thank you.