InlineScript runs in parallel
Hi,
I have a somewhat lengthy pseudorandomization inline script for my item list that I would like to run before my experiment begins (Takes approx. 2min). However, that doesn't seem to work as planned:
1) The code execution is very slow - I can run it in the console in opensesame at normal speed, but when executed during the experiment it is suddenly very slow.
2) The randomization script executes in parallel to the rest of the experiment (canvas items, response items start running while the randomization of the list hasn't finished) and I am not sure why (independent of whether I execute the randomization during the prepare or run phase).
Is there a way that I can perform the randomization online and in sequence? I figure worst case I have to prepare my lists beforehand and read them in as csv's.
I would appreciate any help/feedback anyone could give me!
Thank you already in advance!
kind regards,
Julius
Comments
Hi @JKricheldorff ,
1) The code execution is very slow - I can run it in the console in opensesame at normal speed, but when executed during the experiment it is suddenly very slow.
I suspect it's not the code as such that's slow, but other aspects of the experiment, notably display presentation.
The randomization script executes in parallel to the rest of the experiment (canvas items, response items start running while the randomization of the list hasn't finished) and I am not sure why (independent of whether I execute the randomization during the prepare or run phase).
The script, as you've implemented here, will run serially during the Prepare phase of the experiment, so basically as one of the first things in the experiment. So not in parallel! What makes you think that the code is executed in parallel?
And what kind of library are you using tho implement the constraints for the randomization? Doesn't look familiar to me!
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thanks for your reply!
I suspect it's not the code as such that's slow, but other aspects of the experiment, notably display presentation.
Okay, that is what I suspected. Then it probably is better I read in the lists as not to mess with the rest of the experiment.
The script, as you've implemented here, will run serially during the Prepare phase of the experiment, so basically as one of the first things in the experiment. So not in parallel! What makes you think that the code is executed in parallel?
And what kind of library are you using tho implement the constraints for the randomization? Doesn't look familiar to me!
I wrote the randomization myself in the hopes that I could implement it in the OS experiment using a mix of shuffling and backtracking on a pandas data frame. I made it print statments when it reached a certain stage in the randomization process. The randomization can take one to a few minutes. However, my screen displays already started much earlier and in the console I could still see my function printing at which stage of the randomization it currently was. Hence I suspected that something must have occurred in parallel.
I have now found a work around by simply doing the randomization before and read in the resulting table for my items. I think that is probably the safest option - so i think I have my solution. Thank you for your reply though and creating this awesome program!
Best,
Julius