Keypress influencing display duration
Hi,
I am fairly new to OS (and not a coding genius either :)). I have just set up an experiment where I show the target display for 200 ms (sketchpad duration 0, keypress duration 195), and another blank screen for a variable interval of 600-700ms (sketchpad duration 0, second keypress variable duration 595-695 ms).
What unfortunately happens, is, that a keypress forces the trial to end earlier, as
- the duration of the first and second keypress is shortened if I press a response key within the first 200 ms
- the duration of the second keypress is shortened if I press a response key within the next 600-700 ms
However, I would like to turn this off so I get constant intervals between two target displays (except the random interval mentioned above). In PsychoPy, this is possible by unticking the "force end of routine" tickmark at the stimulus. Is this somehow possible here as well?
Thanks for help and kind regards,
Bence
Comments
Hi @szaszkob ,
Do you want to run your study online or locally? If locally, perhaps you can have a look at the
coroutinefunctionality?If online, you will possibly have to use some lines of
JavaScriptby using aninline_javascriptitem.If you would like to give us more specific help, could you please provide us with some more information about the trial sequence? For example, what is happening in the second part of the trial? What is the second response? (In other words, why didn't you simply add a blank
sketchpadwith a certain duration instead of akeyboard_responseitem with a timeout)?Cheers,
Lotje
Did you like my answer? Feel free to

Hi Lotje,
I intend to run the experiment locally. Attached, you can see the trial sequence in the version without coroutines. I also tried it with a coroutine but did not get the result I was looking for. I also attached the whole version of my to-be-experiment if the .zip if you want to have a better understanding.
The idea is to show stimuli in the target display for 200 ms, followed in the second part of the trial by 600 ms blank screen, answer should be possible during both. I added a second keyboard response (which actually should be the same response) because I did not know how to show two different screens during which a) an answer should be possible b) when a key was pressed OS should not proceed to the next element in the sequence but wait for the 600 ms.
If I added a blank sketchpad with 600 ms duration after the first keyboard response element, an answer would only be possible for the 200 ms defined, right? But if I added only one keyboard response with 800 ms and then a blank sketchpad, then the stimuli would be shown for 800 ms which would be wrong.
The keyboard response should be pos
sible from the moment on the stimuli are shown - 800 ms long.
I designed the trial as the following:
BlockIndication = Is only shown in the first trial in a block and indicates the target for that block.
Fixation_display_begin = Also only shown in the first trial of the block to have the same interval at the beginning as between the following trials
Fixation_display_random_1 = a random interval between 0 and 100 ms at the beginning of the trial
Target_display = Shown for 200 ms (set on 0 in the sketchpad but set by the duration of the following keyboard response), contains the stimuli
Keyboard_response1 = Indicates that response should be possible from the onset of the target display on
Fixation_display_blank + keyboard_response2 = As the interval between the onset of the stimuli should be 800 ms, this is the rest of the time where an answer is possible, showing a blank screen.
Logger = Self-explanatory
Break = Only every 56 trials
Hi Bence,
I added a second keyboard response (which actually should be the same response) because I did not know how to show two different screens during which a) an answer should be possible b) when a key was pressed OS should not proceed to the next element in the sequence but wait for the 600 ms.
There are two possibilities (that I see) to go about this:
1) Use Python code directly. Then you can very straightforwardly use a structure like this (pseudo code):
while (no response given) or (timeout not reached): if elapsed_time < 200: show canvas one() else: show canvas two() key - get_keypress()2) have two keyboard items after each sketchpad (one for 200 the other for 600 ms), and after the second, you compute the response time, based on the total response time.
Does that help? If not I can try to be more specific.
Eduard
Hi Eduard,
It actually seems to work now with the co-routines Lotje mentioned before... I just have to measure if it is the exact timeframe. But many thanks for the code, I will use it as a backup (and in my current experiment I'm programming at the moment :))
Best regards,
Bence