Pseudorandomize with constraint: Each stimulus separated by unequal number of fillers
Dear all,
I have a question with setting up pseudorandomization constraint in Opensesame. I have 24 word stimuli and 72 fillers and need to present all items to the participants in the following way: each word stimulus should be separated by filler (fillers). That means no more than one word stimulus appear in succession. However, there is no requirement about how many fillers to appear in succession.
Is this achievable by adding a few scrip in the loop script? I'm quite green in python coding, so I'll be grateful for your help here! Thank you!
Sandra
Comments
Hi Sandra,
Try that here:
Does that work for you?
Eduard
Hi Eduard,
Many thanks for providing the script.
I initiated a new experiment and tried your script independently. But I'm not sure if I did the sketchpad with the right variable name. So which variable should I use when I present the stimuli in the sketchpad: all_stimuli, stim, combined? I tried all of them in the sketchpad, but opensesame warns that the variable "all_stimuli" (or "stim" or "combined") does not exist.
Here's what I did: I added a new sequence under the new experiment, and under the sequence, I first put an in-line script with the code above and after that comes the sketchpad, on which I cite the [all_stimuli] (or [stim] or [combined]).
I also tried putting inline scrip before the sequence, but the same error occurred. Did I do it in the right way? Thanks!
Sandra
@eduard
Hi Sandra,
First of all,
all_stimuli, because it has the stimuli in the right order in it. To better understand what the code does, you can also run it line by line
To be able to use a variable in a
sketchpadyou have to store it as part ofvar. So, if you, in the end of theinline_script, do this:var.all_stimuli = all_stimuliyou would not get the error message that the variable does not exist.However, the variable
var.all_stimulicontains all the stimuli you want to show in a block, right? So all targets and fillers. So, when you try to presentvar.all_stimuliin asketchpadit will still fail, just because you draw all the stimuli on a singlesketchpad. Even though you probably want to draw each stimulus in a separate one, right?So, the general procedure is as follows
1) Create the list of all stimuli (before the block loop)
2) In the block loop, first pick the current stimulus from the stimulus list in an inline_script (you need to count the current trial number to do so)
3) present that stimulus in the
sketchpadI attach a template for an experiment that does so, from there on you can start working, I hope.
Eduard