psychopy.org | Reference | Downloads | Github

Force end trial if response is made, but end after a time limit if no response is made

Win10
1.85.4
Standalone version

Hi all,

I’m very close to finishing setting up my study, I just seem to have one snag. I’m using a fluid IQ task in which participants are presented with a matrices problem, and have 45s to make a response from 5 possible options (using the categorical rating scale, hover function). I want it so that making a response before the time limit forces the end of the routine (so that people aren’t waiting for a long time after responding), but I also want the routine to end after 45s if no response is made.

The issue I’m having is a strange one: when I let it a trial run through the 45s without making a response, the trial ends, just like I want. This will keep happening for subsequent trials if I never make a response. Great.

When I do make a response, the trial ends (force end routine), and goes to the next one. Great. However, in that next trial, if I leave the trial to run through the 45s, the rating scale doesn’t disappear as it should, instead, the stimulus goes away and the rating scale hangs around on its own for another 32-ish seconds (I’ve not specified this duration anywhere in the component section). The rating scale will disappear after this extra 32s, and then the next trial will begin, starting this whole procedure again (i.e., the newest trial will finish after 45s).

Does anyone have any thoughts as to what might be going on here?

Any help is much appreciated! The entire task script is attached

Ryan

matrices_task.py (8.4 KB)

I’ve managed to find a solution. I copied the code that was used to remove my other stimuli from the screen, and adjusted it for my rating scale. It now works a treat. It works both when I put it directly into the script, and also with code component under “Every Frame”.

frameRemains = 6.0 + 39.0- win.monitorFramePeriod * 0.75  # most of one frame period left
if fluid_IQ_rating.status == STARTED and t >= frameRemains:
   fluid_IQ_rating.setAutoDraw(False)

I hope this is useful to someone else!

1 Like