[solved] Randomized duration of sketchpad presentation
Hi everybody,
I desperately tried to randomized the presentation time of a picture presented in a sketchpad (duration between 400 et 1200 ms), but i don't manage to find the solution, either on Google (I probably missed the information) either by manipulating my code (with random.randint(400,100) for example)... I'm a beginner and i think I need your help.
Many thanks for your tips !
Nadam
Comments
Hi Nadam,
If the presentation time of your
sketchpadis defined asstim_duration, you have to put[stim_duration]in the fielddurationof thesketchpad. Before that, you have to define which valuestim_durationhas on a given trial. If you want it to be selected from a limited set of discrete values (e.g. 400,600,800,1000,1200), it is probably best to add astim_durationvariable to thetrial_sequence. However, if you really want it to be a random interger between 400 and 1200, you have to add aninline_scriptto thesequence(before thesketchpad) and paste this code in theprepare_phase:And that should be it. I hope this helped.
Good luck,
Eduard
Hi Nadam,
You were already pretty close to the solution
You need to switch your values around;
random.randint(100,400). You can't enter this command in the duration box directly though. So before the sketchpad, you could insert an inline_script item where you define the variableexp.duration = random.randint(100, 400). You may have to insertimport randomat the top of this script as well.Now you can insert
[duration](with brackets) in the duration box, that should do the trick.Cheers,
Josh
Double help - awesome
Many thanks to both of you ! It works !