Hi there,
For my experiment, I’ll use the script twice (comprise of session 1 and session 2). I have 100 questions in total, so it will be session 1 will run the rows 0:50, then session 2 run the rows from 51:100, questions do not repeat. I wonder is there a way to do it? Thanks in advance!!
Personally I would write
useRows = '0:50'
if expInfo['session'] == '2':
useRows = '50:100'
and then put $useRows as the selected rows in the loop.
Do you need to automatically select session 1 or 2? If so, and if the participant value is fixed then that sounds like a job for the shelf.
this one is able to selelct certain rows. But what do I do if I want 100 questions to be shuffled first, then select row 0:50 from the shuffled questions?
Do you want to run this online or locally?
Having a random 50% is easy but making the second session present the other 50% is trickier.
One possibility would be to use the participant number as a seed and then read in all of the items, presenting either the first or second half.
I want to run it locally, but maybe I’ll test it online. And I’m also wondering if I run the script for 1.5 hour, will Psychopy crush?
And I tried the way you mentioned, it gave me this error.
I’ve made a demo which works both offline and online. The reason you got an error is because expInfo[‘participant’] is a string, so you need int(expInfo[‘participant’]) to turn it into an integer. Also, useRows won’t act in the way you want it here, since it refers to the unshuffled rows. In my solution I select all rows in the outer loop and then present a subset based on session using an inner loop.
Multi-session Randomisation code | try it
In this demo the random seed of a loop is based on the participant number, but different rows are presented based on the value of session, so that each participant will see all conditions once if they complete all sessions. Each data file will contain information about all conditions, but the ones that weren’t presented can easily be filtered out using the SelectedTrial column.
I see, thank you for your advise, wakecarter, I’ll try the way you suggest and see how it works!