[solved] pseudo-randomisation
Hi everyone,
I am a novice in using OpenSesame and python. I would like to be able to program a pseudo randomisation of my durations.
In my protocol, I have 2 variables:
1/ Facial expression: neutral, sad, happy, angry, fear
2/ Duration: 400 ms, 600ms, 800ms, 1000ms ,1200ms, 1400ms ,1600ms
For a trial, I show a facial expression (e.g sad) for a certain duration ( e.g 400ms).
In my experience I have 35 combinations = 5 (facial expression) x 7 durations
For each combination I must have 8 trials
However, it is necessary that in the first seven trials I show all my durations.
The same thing for trial 8 at 14, trial 15 at 21 etc……
Could you, please, help me?
Thank you very much! Agnès
Comments
Hi Agnès,
Normally you would have a loop item running a (trial-)sequence item, with all conditions appearing at random, meaning you'd have no guarantee of having all durations appear every 7 trials. To take control over this, you could place another loop item within your loop item item, and make sure the trial sequence is contained by the second loop item rather than the first one. (So in total you'd have a loop containing a loop containing a sequence).
Next: in the second loop item, you create the variable
duration, and let it have 7 cycles containing the values 400 to 1600. Each cycle should be run 1 time. If I'm correct, all durations occur 40 times (8 times with each of the 5 faces). So the first loop should run the second loop 40 times.We now need to make sure that all duration/face combinations occur evenly. To do that, you need 7 lists, that each contain each emotion 8 times. Place an inline_script at the top of your experiment, and create 7 lists by means of
Then you want to add emotions to them. Either you could insert the 40 emotions to each list by means of adding them manually (e.g. change
[]into['sad','sad'...], or by creating a for loop:You then want to give these lists a shuffle:
Finally, in the (trial-)sequence item you can insert another inline_script, and here we will create the variable that sets the emotion for that specific trial:
If you're using a sketchpad in the sequence to display your stimuli, make sure you 'set' the emotion variable so it becomes available outside of the inline script:
In the sketchpad, the duration can be set to
[duration], and the image will be[emotion].jpg(of course that is if you actually named your pictures happy.jpg and such).Good luck!
Josh
Solved problem
Thanks a lot for the solution
Agnès