Setting the duration based on reaction time

Hello! I am trying to set up my task so that, after participant select a response, the objects disappear and a blank screen is displayed for the remaining allotted time (i.e., 12 seconds minus however long it took them to make a response). That way, the timing of each response trial will be exactly 12 seconds no matter how long it takes them to select a response.

I have the duration of each object in the routine set to a variable (timestop), which defined in my conditions file. After each response trial, I have a blank screen appear. I have attempted to set the duration of this blank screen by setting the timestop condition value to “12 - $key_resp.rt” or just “12 - key_resp.rt”

This gives me the following error:
“TypeError: ufunc ‘add’ did not contain a loop with signature matching types dtype(’<U32’) dtype(’<U32’) dtype(’<U32’)”

I also tried inserting a code component in both the “every frame” and “begin routine” tabs:

if key_resp.keys == '1' or key_resp.keys == '2':
    timestop = 12 - key_resp.rt

This does not produce an error, but does not give the desired effect - the blank screen stays up for the arbitrary amount of seconds that I set in the conditions file (it gave me an error if I left it blank) instead of subtracting out the reaction time for the prior trail.

Any ideas would be extremely helpful. Thank you.

Hi Sarah,

A potential solution would be to keep the trial length constant and to stop showing the objects after a response has occured. Please find a simple demonstration attached.

Jan

constant_trial_length.psyexp (7.1 KB)