Inter Stimulus Interval (ISI) based on Reaction Time

Hi there,

I am currently programming an Attention Network Task. After each trial, a blank screen is presented for a variable duration. The duration depends on the reaction time on the previous trial (left, right key to determine the direction of the arrows). More specifically, the duration of the blank screen will be 3.2s - the reaction time (which is 1.7ms max, or the routine will end so there will not be any negative durations). I have tried to add this feature using code component in the builder view:

if t >= 3.2 - key_resp_3.rt:
continueRoutine = wrong

and then added $t to the condition box for stop of the empty screen image. When running the experiment this error message comes up: TypeError: unsupported operand type(s) for -: ‘float’ and ‘list’
################ Experiment ended with exit code 1.

Thank you!

This sounds to me as if key_resp_3.rt is a list containing a number, which cannot be subtracted from a number. Maybe it’s enough to use key_resp_3.rt[0] instead. Also, use False, instead of wrong.

So, in sum

if t >= 3.2 - key_resp_3.rt[0]:
    continueRoutine = False

I created a little minimal example to see for myself what the problem might be. But curiously, I don’t get that error using your original code.

Could you have a look and see if there is anything different from your experiment?

test.psyexp (11.1 KB)

But what happens when you run the file that I sent?

And which PsychoPy version are you using?

Okay, then the error must stem from some other aspect of your experiment. Could you post the psyexp, so I can have a look?

You could do this by saying:

if key_resp_3.rt:
    if t >= 3.2 - key_resp_3.rt:
        continueRoutine = False
else:
     if t >= 3.2 - 1.7:
        continueRoutine = False

Hi @ninaz, I just noticed that what I coded was not exactly what you were asking for. So just in case you did not notice I wanted to make you aware of it and edited the solution accordingly.

1 Like