psychopy.org | Reference | Downloads | Github

GO/NOGO protocol for fMRI

OS: Windows 8 64-bits
PsychoPy version: 1.85.4
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?: Hi, I’m trying to adapt a GO/NOGO protocol from Price et al., 2016. Food-specific response inhibition, dietary restraint and snack intake in lean and overweight/obese adults:a moderated-mediation model for an fMRI experiment.
The task consists in 50 trias (40 go and 10 no-go). During go trials the subject should press a key as fast as possible. During no-go trials, no key should be pressed. Each trial is composed by an image presented for 750ms and was separated by a blank screen for 500 ms and preceded by a fixation cross for 500 ms. The sequence of go/nogo stimuli are predetermined. Two set of images are used: 10 go images (each one is presented 4 times) and 10 no-go images (each one is presented one time). Image order should be randomized across subjects.
I have two questions:

  1. How is possible to have this fixed sequence and change the images for each subject? Based on some examples, I have tried using 2 loops, an outer loop having my fixed sequence and be called once from a sequence.xlsx file with 2 columns (stimType and conditionFile), and an inner loop with the go/nogo list of images from 2 files having 10 rows each one with the image addresses.
    But it does not work properly. Images are not randomized, and all 10 images are shown for each row of the sequence file.
  2. In order to optimize the experiment to the fMRI, I want to have the blank screen duration varying from 500 to 1500 ms. To achieve this I’m using the following code under begin routine:
    jitter = np.arange(0.5, 1.5, 0.25)
    shuffle(jitter)
    And setting the duration of the blank screen as $jitter[0]. This works fine. The problem is I need to know the onset time when each image was presented, and this should be synchronized with my fMRI acquisition. The scanner send triggers on each slice (TR = 2000 ms, n of slices = 34). Triggers are send through an USB port and received as ‘s’ character. I’ve add the following code under each frame to save the onset time, but it seems that time changes depending whether a response is gave or not, i.e. if a key is pressed:
    if trials.thisN == 0 and frameN == 0: # start of the loop
    loop_start_time = globalClock.getTime()
    elif frameN == 1: # the zeroth frame has just been drawn
    stimulus_start_time = globalClock.getTime() - loop_start_time

    store the data:

    thisExp.addData(‘stimulus_start_time’, stimulus_start_time)

I am sorry if this are basic questions, and I really appreciate any help. I’ve uploaded the conditions files, and the builder file to make it easier to understand.

Thanks in advance,
FernandaGO.xlsx (8.8 KB)
sequence.xlsx (33.1 KB)
go_nogo_questions.psyexp (22.5 KB)
NOGO.xlsx (8.8 KB)