|
Post by gian89 on May 7, 2021 14:19:14 GMT
Hi all,
I want to present a picture for 5 minutes. Participants are asked to press one of two keypresses when they perceive one pattern or the other in the same picture. The same picture should be displayed for 5 minutes. Now, when a response is given, the stimulus disappears.
This is my code so far
table table1 Necker
task table1_task table table1 keys f j show bitmap @1 # stimulus to display for 5 minutes readkey 3 300000 save BLOCKNAME @1 RT KEY
Would you have any suggestions to display the picture for 5 minutes while recording RT and Keypress?
Thank you so much for your help
|
|
|
Post by PsyToolkit on May 10, 2021 11:47:16 GMT
This can be done easily.
There are different scenario.
One is that you just want ONE keypress and that is it, but I assume that is not what you want (otherwise, why keep showing the picture). So I will assume you want to store a range of key presses. That is possible too and most easily done with a "while" loop.
While this is easy to do, you might have more complex data files. You need to think of what data you want to store and in which format. There are different ways to do it. Maybe you actually do not want to save the actual keypressed, but only how many key presses of two types? It is all possible. You would just add some code.
In any case, I will show you the simplest way, which will save the key and reaction time on a separate line in your data file.
task table1_task table table1 keys f j save "begin of trial"
show bitmap @1 # stimulus to display for 5 minutes
timestamp my_start timestamp time_now
set $timepassed timestamp-diff my_start time_now
while $timepassed < 300000
readkey 1 1000 set $my_counter increase
save $my_counter KEY RT while-end save "end of trial"
By the way, at the end of the trial, the image is deleted. If a participants in your original example would press before 5 minutes, the trial ends and the stimulus disappears.
|
|
|
Post by gian89 on May 10, 2021 13:29:39 GMT
Thank you for your prompt and detailed answer
I tried to run your code but the one image “necker” (a famous necker cube) defined in the table is displayed virtually forever and the trial does not end and therefore also data are not saved. For convenience I copy the code of all experiment:
options fullscreen
bitmaps Necker pic1 pic2 pic3 pic4 Instruction
table table1 Necker
task table1_task table table1 keys f j save "begin of trial" show bitmap @1 # stimulus to display for 5 minutes timestamp my_start timestamp time_now set $timepassed timestamp-diff my_start time_now while $timepassed < 30000 readkey 1 1000 set $my_counter increase save $my_counter KEY RT while-end save "end of trial"
message Instruction
block block1 tasklist table1_task 1 fixed end
Here the details of the experiment: We have two blocks. In one block we show only one picture, a Necker cube, for 5 minutes and participants have to press the key “f” when they perceive the cube in one of the two possible orientations, and the key “j” for the other. Since we are also measuring the time in the switch of the perception, we need to collect the actual key pressed and its exact timestamp
The second block, lasts approximately 5 minutes (31200 msec in total) and consists of presentation of 13 cycles of modified Necker cube pictures. Each cycle consists of the presentation of pictures in this following static order: pic1 – pic2 – pic3 – pic4 – pic3 – pic2. There is no break between cycles and each picture is presented for 400 msec (timing should be jittered) and therefore one cycle consists of 2400 msec. Like in the first block, participants are asked to press “f” and “j” and we need to save again actual key pressed, timestamps, and the presented picture. Would you have any tips for programming this second block as well?
Thank you very much for your help!
|
|