Hi everyone,
I am new to PsychoPy and running EEG studies. I am currently setting up a recognition visual working memory task using EEG in Builder. Participants will first view an initial image, then, after a delay period, will see a new image. They will be asked to respond whether the new image is the ‘same’ or ‘different’ to the initial image, using the keyboard (4s timeout period if no response given).
We are recording EEG data (serial port) to send triggers from PsychoPy to the EEG software at four phases in each trial: encoding (when the initial image is shown); delay (when the delay period begins); retrieval (when the new image is shown); and response (when the keyboard response is given). The stimuli differ in load and semantic availability, which will be represented via the trigger numbers. Since different trigger numbers are being sent depending on the stimulus type, I am sending the triggers via code components, with ‘load’ and ‘semantics’ for each stimulus defined in my conditions Excel file.
I have tried various different versions of the code to send the triggers and every time I have been finding that there are around 10–15 triggers missing throughout the task. This occurs in different phases (encoding, delay, retrieval, response) and trials.
Here is the code I have at the moment in the encoding, delay, and retrieval phase:
Begin Routine
if semantics == 'low' and load = 'low':
win.callOnFlip(send_trigger, 1)
elif semantics == 'low' and load = 'medium':
win.callOnFlip(send_trigger, 2)
This is repeated for the rest of the load and semantic combinations.
Here is the code I have at the moment for the keyboard response (separate triggers for correct vs incorrect, defined with a variable called correct_key as the correct response is counterbalanced)
End Routine
if keypress2.keys:
if keypress2.keys == correct_key:
send_trigger(1)
else:
send_trigger(2)
else:
send_trigger(2) # Send incorrect trigger for no response within allowed time
How can I reliably send triggers for each trial and phase? As I am only missing a few triggers randomly across the experiment I presume that this could be a timing issue? I would really appreciate any advice or guidance.
Thanks,
Rebecca