Hi All,
I’m new to Psychopy, so please go easy. I’m trying to use it to run a simple fMRI experiment, and am having some trouble (probably conceptually) about how to use scanner triggers to control experimental flow (i.e. timing).
I would normally have my experiment wait for a certain number of triggers to have been received before proceeding to show a stimulus, followed by rest, then a rating period, before returning to the fixation cross (default position) waiting for the a number of triggers to have been received before showing the next picture, and so on…
In pseudo-code this looks like (TR = 3 sec), sorry can’t get tabs to work, so formatting is horrible
triggers = 3
triggerCount = 0
[main loop]
while expt is running:
display fixation cross
flip display
get incoming keypresses (looking for '5’s)
if key is ‘5’:
add one to triggerCount
if triggerCount > triggers: # start stimulation section
[update triggers to set ITI]
triggers += 10
[present stimulus]
show picture
flip display
core.wait (5.0)
[present fixation]
show fixation
flip display
core.wait (8.0)
[present rating scale (configured to display for 8.0 seconds, no accept button allowed)]
myRatingScale
[end stimulation section]
[end of main loop]
My problem is that I would like the 2nd period of stimulation to occur when more than 13 triggers have been received, but because I’m stuck in my stimulation section, where there are lots of core.waits, Psychopy is “missing” (i.e. not counting) the '5’s that keep on rolling in.
I.e. the first stimulus should be presented after 9 seconds (triggerCount > 3), and then the second should be presented after 39 seconds (triggerCount > 13), the next after 69 seconds (triggerCount>23), and so on (ITI is 30seconds).
What are the “tricks” for achieving this?
Best wishes,
Jon
p.s. any hints on how to get tab characters when using this webpage would be much appreciated.