[open] Block Randomisation with Inline Script at the Run Phase
Hi
I am using the following script to randomise across the blocks. This randomises the blocks presentations BUT the number of presentation is more than the number of blocks. Can you please advice have to fixit?
I also like to use the dummy variables in the the blocks to have special randomisation orders.
Thanks in advance,
Masoud
from random import shuffle
# Uncomment for 0.25 and before
# exp = self.experiment
# Create a list of items that are part of the sequence
# These items must be present somewhere in the experiment.
# An easy solution is to add them to a dummy_sequence at
# the start of the trial and set the 'run if' statement of
# the dummy_sequence to 'never'.
item_list = ['loop1', 'loop2', 'loop3', 'loop4','loop5','loop6']
# Randomize the item order. Of course you can also do more
# complicated things, such as have the order depend on the
# subject nr, etc.
shuffle(item_list)
# First, prepare all items
for item in item_list:
exp.items[item].prepare()
# Now run them!
for item in item_list:
exp.items[item].run()

Comments
Hi Masoud,
You should set the Run if statements of the loops to 'never', like so:
Otherwise all loops are executed once in the normal way, and once by your inline script.
Does that make sense?
Best,
Lotje
Did you like my answer? Feel free to

Dear Lotje
Your kind comment works well. Thanks.
Peace,
Masoud
Dear Lojte
Can I also use the dummy variables in the the blocks to have special randomisation orders?
Masoud
Hi Masoud,
What kind of 'special randomisation' do you mean? If you provide us with some more information about how exactly you would like to randomise your blocks I'm sure we can figure something out.
Best wishes,
Lotje
Did you like my answer? Feel free to

Dear Lojte,
Here it is the design where I have 6 blocks, each one includes two sets of word stimuli with a relation between them (e.g., Shorter Than [ST] or Taller Than [TT]) to be learned and then to be tested by participants.
Therefore, There will be ten possible pairs in each block, presented in a random sequence, and then a different random sequence of those same ten pairs again, such we have 20 relation shown.
The point is that the same pair should not be presented successively twice (as this could happen at the point of transition between the first and the second random sequence).
So one way to deal with that is :
Within each random series of 10 pairs, to create a second random sequence of 0,1 to determine the left-right orientation of the display. So, for the first random series of 10 pairs we might have created the orientation sequence [0010111001] which means that, combined with the first random sequence (which determines the order of pairs), we would now have the following presentation schedule for the first 10 pairs, for example:
For the second series of 10 pairs (in a new random sequence), we just reverse the orientation for each pair, vis-a-vis the first series. So we get, for example:
The program is ready now except for this randomization order, which I hope I could handle it.
Any advice is appreciated.
P.S: I have asked the same question from Sebastiaaan at the follwing address but it seems to me somehow difficult to understand.
http://www.cogsci.nl/forum/index.php?p=/discussion/565/open-conditioned-randomisation-across-the-trial-sequence#Item_2
Thanks,
Masoud
..and here it is the trial sequences as formatted text:
Masoud
Hi Massoud,
To make pseudo-random trial lists, I would advise you to download a program called Mix. This allows you to put constraints like the ones you describe above, to your trial list. After making pseudorandom trial lists, you can simply copy-and-paste those in your loop items, and set the duration to 'sequential', instead of 'random'.
Mix can be downloaded here:
And the reference is:
Van Casteren, M., & Davis, M. H. (2006). Mix, a program for pseudorandomization. Behavior research methods, 38(4), 584–589.
I hope this helps.
Best wishes,
Did you like my answer? Feel free to

Dear Lojte
Thanks, but I guess then the same random order will be shown to all the participants. Indeed I am looking for a solution to present a unique random order to each of the participants.
Masoud
Hi Masoud,
I see what you mean. Unfortunately, I don't know of any method to do this in a fully-automatised manner.
If I want to pseudo-randomise trial lists, I use Mix to generate new trial lists for every participant, and change the block loop accordingly. If you don't mind doing this manually, perhaps you could consider a similar method.
Good luck!
Best,
Lotje
Did you like my answer? Feel free to
