Serial reaction time task (SRT)
in OpenSesame
I am planning to programme an SRT task.
Is there anyone who programmed a serial reaction time task in open sesame already?
I would be grateful for scripts or any helpful comments.
The tricky thing is:
I have a series of 10 consecutive stimuli / "trials" (fixed sequence) which repeats 10 times (100 stimuli in total).
However, the series is starting at any point of the 10 stimuli.
Comments
I actually want to log every sinlge keypress. That's why i inserted a logger item after each stimulus.
No the next question: Is it possible to insert a variable in the logfile that contains the name of the previous stimulus/picture? Just for an easy match of response times and stimulus.
Hi Dahm,
I have to admit I don't really understand your design. Could you maybe explain again with a little more detail?
Thanks,
Eduard
Hi Eduard,
here the main design of the SRT task.
Participants are instructed to press one special key on each stimulus. We have four different stimuli (resulting in four different responses). What participants do not know is that the stimuli appear in a fixed sequence (10 trials), which repeats (10 times). So they perform 100 presses in a row and learn the sequence implicitly (motor learning). The sequence shall start at a random point.
My idea was something like this:
I have build the sequence with the ten stimuli, ten responses, and ten loggers.
Now i put this sequence in a loop, so that it repeats 11 times. I define a random number x from 1-10. Now from the first sequence x trials will be skipped. And from the last sequence 10-x trials will be skipped at the end.
However, i have very little experience with programming in open sesame.
Stephan
Another idea:
I build ten sequences each starting at a different point of the sequence. Then i put them all in one loop and select randomly only one of them. But how do i put more than one sequence in a loop?
Hi Stephan,
Not sure whether there is a solution that relies only on OpenSesame items and doesn't require some coding, but this idea was the first that came to my mind. So, I basically, you define all the sequences and important information in
inline_scriptsusing python directly.This piece of code you execute once per subject, to define the random sequence. Therefore, it is best to put it once in the beginning of the experiment before you enter the loop, in which you present the sequence to the participants.
In the loop itself you can add this code. It takes care of stimulus presentation, response collection, and evaluation whether response is correct or not. Note, you need to place a logger item in the
loopafter theinline_scriptDoes this make sense?
Eduard
Hey Eduard,
i have now decided to use inline_scripts only. So your suggestions may help even more.
I have replaced "cv.text(stim)" with "cv.image(stim)". But unfortunately this does not work out in my case.
This is what i placed in the "prepare section"
and this is what i placed in the start section
Hi,
Three remarks:
1) Watch out that you don't add unnecessary whitespaces.
A_path = pool ['0_A.tif']won't work due to the space betweenpooland[2) Watch out to include brackets when you call a function
key, time = kb.get_keywon't work becausekb.get_key()is a function that is only doing what it is supposed to do, when brackets are attached to it.3) If you describe that something is not doing what it is supposed to do, provide the complete error message. This way, it will be a lot easier to track the issues down.
Thanks,
Eduard
Thanks for your remarks.
1) Actually this works even with the space. Anyway i will try to avoid unnessary spaces
2) I am sorry for this. Unfortunately the error is above, so i did not even come to this point.
3) cv.image(stim) makes the problem. you suggested cv.text(stim). As i use image items i thought i would be good to change it.
Here is the complete error message:
By the way. Does it help if i attach the file?
Hi,
Ah, I missed another little error in your code: You forgot to class the brackets in this line:
kb = keyboard(allowed_responses = ['f','g','h','j']. So, it should bekb = keyboard(allowed_responses = ['f','g','h','j'])Eduard
I am sorry for the bracket error.
Unknown argument: allowed_responses
so i tried "keylist" instead of "allowed_responses"
"" does not exist
What is not working?
kb = keyboard(keylist = ['f','g','h','j'])should be fine (sorry for the allowed_responses error)Stopped:
The experiment could not be terminated because of the following reasons:
"" does not exist
Thats the complete error message when i use keylist.
INFO: i am using legacy back-end.
Can you copy the entire error message, please? I need more information, i.e. which line, etc... (Btw, I can't open your experiment due to this problem.
Eduard
In order to solve the file format problem i used a file of a colleague and overwrote it.
Now it should be possible to open the file.
It runs now with xperiment back-end.
And now i get a more sophisticated error message:
Hi,
I see now. What you had defined as
stimwas not the image, but already the canvas to which the image was drawn. so callingcv.image(stim)was trying to draw a canvas onto a canvas with the draw-image-function. So, instead ofcv.image(stim), just show itstim.show(), and you should be good.Eduard
Hey Eduard. Thank you very much. I reached a big step further.

Unfortunately i am very new to python. I am even struggeling to make a simple loop
But i noticed that we do not need stim, which shortens the text substantially.
Could you help me with the loop, please?
in the preparation i need to multiply the sequence
is there a shortcut, instead of repeating the whole statement? something like this...
A
for-loophas the structure:If you a very new to python, then you should first invest some time and get familiar with it. It is easy to learn and you will benefit from it a lot (you wouldn't have to rely on others to make experiments).
There are plenty of nice python tutorials online that will teach you enough to make an experiment like that.
See here for example: http://osdoc.cogsci.nl/3.1/manual/python/about/
Eduard
Thanks a lot.
I already found a list of tutorials earlier this week on this page https://computingforpsychologists.wordpress.com/tag/python/
My problem on these tutorials is that they want to teach me how to make calculations, data structuring etc. But that is not exactly what i am looking for. I can use "R" for these things. I want to use python only for programming experiments. Until now i have not found a tutorial on this...
You'll find a link to such a tutorial in the link I provided above. Or simple google for python basics tutorial.