Coding for two variable response conditions

Hello everyone,
I’m a Psychology student and I’ve been trying to design an experiment for a project, however I got blocked at the time I had to use codes for improving some details. (By the way, as I lack of any experience in this field, my question might be sort of genuine).

The experiment routine is the following:

Fixation (400 ms duration) > Stimulus Display (600 ms duration as maximum) > Blank Background (its duration will get max. to 3600ms counting from moment 0 in the timeline)

The response might occur from 250 ms after the Stimulus is displayed to the moment the experiment ends at 3600 ms. Depending when the response occur we will face two conditions:

A) Response 250 - 1600 ms from the Stimulus Display → A Blank Background will be shown with a duration of 1000 ms itself. After that, Trial 2 would begin with fixation.

B) Response over 1600ms from the Stimulus Display → Trial 2 would begin with fixation.

So, here it’s the problem, I don’t know how to code in order to set the two previous conditions

Thanks!

That is an excellent description of your problem. I wish everyone would do that!

What you need to do is insert another routine after your trial routine. Create a black stimulus to take up the entire screen and have a duration of 1000 ms. Also insert a code component, from the “custom” component panel. In the “begin routine” tab, put some code something like this:

# skip this routine if RT > 1600 ms:
if your_keyboard_component_name.rt > 1.600:
    continueRoutine = False
    thisExp.addData('pause_shown', False) # just so you can check in the data file
else:
    thisExp.addData('pause_shown', True)

I’m not sure if 1.6 is the actual value to check against - you might need to take into account the fixation duration and the when the keyboard component started - hence have inserted some optional lines to record what happened in the data file, so you can check the outcome against the reaction time.

Demo1.psyexp (31.5 KB)

Hello Michael,

Thanks for your replay. I’ve tried several times what you told me, nevertheless, I haven’t been able to obtain any results, probably I will be missing something but I don’t get to know what it is. As I lack of any experience in coding, is there any way to design this part of the experiment from the Builder?

In case it is not possible, the experiment script file is attached, please could you tell me how (and where) to codify the instructions I specified in the last post?

Thank you so much