OS: Win 10
PsychoPy version : 3.0.5
**Standard Standalone?: yes
What are you trying to achieve?:
In my experiment, participants are presented with a stimulus for 1000ms, and then a 3000ms blank screen is displayed. Participants are free to make a response at any point during this 4000ms duration. A feedback screen indicating correct/incorrect displays briefly for another 500ms, and finally another blank screen appears for 2000ms. The experiment is already built and works well, with each trial lasting 6500ms. Each trial consists of two builder routines: 1 displays the stimulus and first blank screen, and the second provides feedback and displays the second blank screen.
Now, my supervisor wants me to change how feedback is given slightly, and it’s giving me a bit of trouble. First, if no response is made during a trial it will play out as explained above for 6500ms and give an incorrect feedback display. What we want to do now is give feedback 2000ms after a response is made. The response can still be made at any point during the 1000ms stimulus display and 3000ms blank screen, but once the response is made, feedback should come 2000ms after the key response. Additionally, each trial should still be 6500ms.
So if the person responds very quickly (at 500ms post-stimulus onset), the blank screen will only display for 1500ms, feedback for 500ms, and the second blank screen will be extended to 3500ms to preserve the 6500ms trial time. The same logic applies if participants respond late (say 3500ms post-stimulus onset): the first blank screen will be extended 2000ms from response, and the second post-feedback blank screen will be shortened, again to preserve the 6500ms trial time.
Hopefully this makes sense. The stimulus and feedback will always be 1000ms and 500ms in duration respectively, but the two blank screens will need to be varied in time to account for the 2000ms feedback rule, and 6500ms total time rule.
OS: Win 10
Just to clarify: You say that “once the response is made, feedback should come 2000ms after the key response”. You also say that “if the person responds very quickly (at 500ms post-stimulus onset), the blank screen will only display for 1500ms, feedback for 500ms”. It seems to me that in your example feedback comes after 1500 ms, not after 2000 ms. Or am I misunderstanding something?
Thank you for the response. To clarify, the stimulus will always display for 1000ms. So if the participant presses the key 500ms post-stimulus onset, the stimulus will still be on screen for 500ms more. The blank screen should therefore only be displayed for 1500ms because that would be 2000ms post-response (500ms + 1500ms).
Ah, I see. Sorry, I missed the bit about the stimulus always being displayed for 1000 ms. That complicates things somewhat… I’ll think about it.
Since my initial post I have been working on solving the problem. I have made a little progress, but am still stumped. I thought I would post what I have done so far to see if someone could guide me forward a bit.
I have added a code component to the routine that has the the stimulus and first wait screen. I decided to try adding a countdown timer to control when the routine ends. This is what I added:
if response.keys: timer=core.CountdownTimer(2) while timer.getTime() > 0: continueRoutine=True else: continueRoutine=False
The code sort of works, but doesn’t quite do what I want. Once the participant responds I want a timer to count from 2000ms to 0 and then end the routine and go to the feedback routine. The code above actually does end the routine 2 seconds after a key press and transitions to the feedback routine, but it freezes the routine for 2 seconds as well. That means if participants press a key when the stimulus is displayed, the screen will freeze on the stimulus for 2 seconds rather than go to the first blank screen. So the routine freezes for 2 seconds after the key press as opposed to play out normally for 2 seconds.
How might I change the code above to allow the routine to play out normally and then transition to the feedback routine 2 seconds after a key press?
After thinking about this again, I realised it’s not actually that complicated. I just had to let go of my initial idea. This is what I would suggest:
- Have just one routine
- Pre-determine the length of the routine using a dummy text component (length 6.5 s)
- Allow a response in the first 4 s
- Make sure the response does not end the routine
- Set the default feedback onset to 4 s
- Now, the only thing you need to do is check for the occurrence of a response; if a response occurs, get its onset and add 2 s to it; use this time to update the onset of your feedback (so, the basic idea is to move around the onset of the feedback in a routine of fixed length depending on the occurrence of a response)
Please find a minimal working example attached. What’s missing: The example does not check whether or not the response was accurate.
Note: If the response occurs very late, there will basically be no ITI.
Hope this helps.
variable_FB_onset.psyexp (10.1 KB)