URL of experiment: https://run.pavlovia.org/taylormez/numseqexperiment/html
Description of the problem: I am using specific random seeds for this experiment, but it appears that the random seeds from PsychoPy do not translate directly to Pavlovia. Is there a way to keep them the same? I have selected specific seeds to be the correct level of difficulty in my experiment, so I cannot simply use whichever one it spits out. I would appreciate any help! I have been having a lot of technical difficulties putting things online, and once I finally got it to work, this happened
Sorry to read you’ve had so many technical difficulties, but nice that you’re almost there! Below are two sections: one covers a possible quick-fixes for your experiment and the other is a brief reflection on random number generation in PsychoPy and PsychoJS.
Let me start with the bad news: on short notice, we won’t manage to have random sequences by PsychoJS and PsychoPy with the same seed be equal. See the other section below for the intricacies we need to iron out to achieve this.
Possible quick fixes
- If there is a fixed maximum number of trials per difficulty level, you could generate list of random numbers (with the seeds you already picked) via PsychoPy, then use that list in PsychoJS.
- If not, the best I can think of is finding a new set of seeds for sequences that matches your requirements in PsychoJS.
Random Number generation in PsychoPy and PsychoJS
- I think PsychoPy uses the random number generator provided by numpy by default. In their documentation I see that they provide four different algorithms: PCG-64, MT19937, Philox, and SFC64.
- PsychoJS uses the random number generator provided by seedrandom. That one provides seven different algorithms.
The annoying thing is that none of the algorithms supported by numpy are supported by PsychoJS, and vice versa. Replacing one of our libraries with one that does match up isn’t trivial I’m afraid, so that’s why this could take a while to fix.
I hope this helps,
Thank you so much! I really appreciate all of the information. I will see if I can figure this out according to your suggestions, but knowing it isn’t trivial is useful either way. It may be in my best interest to just remake the experiment with set orders via my spreadsheets.
One more thing, just to make sure I am not wasting time. Does PsychoJS’s seedrandom at least maintain the orders of selected seeds throughout? Seems like this would be the case, but just want to make sure, since you mentioned 7 algorithms. If I can find orderings I like, I can easily just change my seeds to the correct ones. Also, is it possible for me to find the orders it generates for specific seeds anywhere? I just need to establish relatively difficult patterns that are similar between my conditions, which would be quite simple if I could test out the seeds first.
Hey again Taylor,
Happy this helps! Here are answers to your other questions:
How consistent are PsychoJS seeded random sequences? I happen to have run some tests on this last week, where I compared a couple of such sequences across about 100 devices. They were perfectly consistent, though I should mention the sequences I generated were relatively short (up to 8 trials). If such consistency is critical to your experiment, I’d still recommend generating the sequences in advance, just to be sure.
Are there lists of sequences given a random seed available? Not that I’m aware of, but we could write a bit of script to generate such tables. Given what I said in answer above, would you prefer one in Python or JS?
Thank you! I am thinking the simplest thing for me would just be to figure out what the JS random seeds will generate. That way, all I have to do is go change the values in my spreadsheets to ones that will work well. I essentially just need to know what the seed would generate for a sequence of 1-6. I have 2 repetitions of each of my 3 stimuli, and just need to select an order that does not, for example, present multiple of the same stimuli in a row.
I truly appreciate your help!
Don’t worry about the code, as I figured out how to get it to work. I just made a new study to test out the seeds. Thank you for your help!