Monkey-patching for more flexible randomisation in OpenSesame
Hi,
I'm posting this for two contradictory purposes:
- In case anyone finds it useful in the future
- In case there is a better way to do this, so I don't do it again!
There is a table (Loop object) where the first 32 rows are experimental trials, and the next 96 are filler. We want to initially run 3 filler trials, then an experimental trial, then 2, 3 or 4 fillers before each remaining experimental trial. So if F represents filler and X experimental trial, the sequence will look something like this:
FFFXFFXFFXFFFFXFFFXFFFFX ....
My idea was to replace the run() method in the relevant Loop item, and use this to randomise the trials as we require. This method is an adapted version of the run() in the original code (module libopensesame.loop). My code to perform the replacement was:
https://gist.github.com/anonymous/66b01a1b3deb0db6dfcc
(I will also copy this code into a reply comment on this post, for posterity)
This was placed in the Prepare phase of an inline code item.
I'd be interested to know what other OpenSesame users (and the developers!) think of this.
Regards,
Alisdair
Comments
Thanks for sharing!
Check out SigmundAI.eu for our OpenSesame AI assistant!