Shuffle order of multiple routines

URL of experiment: cigarette_habits_deprived [PsychoPy]

Description of the problem:

Hello,

I would like to randomise the order of multiple routines (see screenshot). Routines framed in purple should appear randomly either where they are or at the beginning where there is the purple arrow.

I have tried to add loops and the following code in the begin experiment tab

orders=[[1,0],[0,1]]
util.shuffle(orders)

where I added orders[0][outerloopname.thisN] and orders[1][outerloopname.thisN] in the nreps fields of the inner loops but it doesn’t work.

Could someone help?

Thanks a lot

Hi There,

It is possible that this is associated with the issue using ‘thisN’ online (continueRoutine = False Problem, although it is in Each Frame) can you try replacing outerloopname.thisN with a custom ‘index’ variable (continueRoutine = False Problem, although it is in Each Frame)

Becca

I haven’t tested it yet but I’m hoping.thisN has been fixed in 2020.2.5 just released.

I haven’t tested either but couldn’t see this on the list of bug fixes for the release. But yes, trying an update of PsychoPy could be another route to try :slight_smile:

Hello and thanks for your replies

I installed the latest psychopy version and tried to update a “test” experiment (not my real experiment because I didn’t dare to update my current experiment for fear that something would not work anymore after the update). And indeed, the online experiment gets stuck on initialising. I don’t think that it is because of the outerloopname.thisN because it doesn’t work without either.

I’m launching my experiment soon (the counterbalanced order is the last thing to fix), so I’m not sure if it is a good idea to sync with the new version if I’m not sure that .thisN has been fixed now.

Maybe you have other ideas?

If you are stuck on the initializing page that means there is a syntax error on the JS side somewhere - do you get a line number for that error when you open developer tools?


do you mean this @Becca?

yes I do! When I clicked the link to your experiment just now it seemed to work - so I guess you might have resolved this?:slight_smile:

Becca

No I couldn’t resolve it yet. :confused:
I didn’t do the changes on the link I have shared but on a test experiment, because I was afraid that my real experiment gets stuck with the update. So the link you’ve tried is “intact” but I did not sync with the update and did not add the .thisN part of the code I need. But it doesn’t work on my test experiment where I tried to do the changes.

Aha OK, well this issue looks like a failed to load resources error. Can you try adding any resources you need for the task by using experiment settings (cog symb) >online tab then add any resources you need using the ‘+’ icon?

Do you mean this? Or on Pavlovia? Couldn’t find any ‘+’ icon…

oo interesting - perhaps you are running an older version of psychopy where that option wasn’t available - are you able to try using the new release?https://github.com/psychopy/psychopy/releases

Hi there! I have a similar problem and I was wondering if you were able to figure out how to solve this? I’m extremely new to coding so its been a bit of a mess, but I have 2 routines set up as stair cases, and another loop around them to randomize the order (eventually there will be 8 routines that I would like to shuffle between), but it doesn’t seem to work.

shuffleBlocks needs to point to a spreadsheet with two (eight) columns called NumberReps, ColourReps, etc.

Put the nReps for NumberStair as NumberReps, etc

Each row in the shuffle sheet should have 0 in all columns apart from the key on, where it should be your maximum number of loops in your staircase.

1 Like

I tried this, but it still isn’t shuffling so I don’t think I quite understand. (Once again I apologize for my ineptitude with all of this)

In your spreadsheet you need 0 1 in the first row and 1 0 in the second row, not 0 0 and 1 1 .

Are you trying to use a staircase loop online? Does that work now?

Best wishes,

Wakefield

It still doesn’t work so is this what you meant? I haven’t run it online yet, so I don’t know for sure if the staircase loop works, I wasn’t aware there was a problem with it to be honest!

Please can I highlight this documentation which might be helpful (specifically - counterbalancing subtasks) Blocks of trials and counterbalancing — PsychoPy v2020.2

Ps. a staircasing loop wont work online. Please see this demo for a staircase Rebecca Hirst / staircase-demo · GitLab or this for interleaved staircases Rebecca Hirst / interleaved-staircase · GitLab to be used online

Hi again-
I really appreciate your help! I managed to fix my stair case by looking at your custom scripts and integrating it with my protocol, how ever now I’m having issues where the stimulus images for the task aren’t pulling in to pavlovia when I try to run it online. So like how you have your green and basic gradients, when it goes to present the task the pictures don’t show up. I was wondering if you had encountered this problem or had any idea on how to remedy it? It’s working fine now in psychopy but I need to be able to run it online.

Hi There,

This sounds like a slightly different issue (so maybe mark the solution for the original query here and start a new topic :slight_smile: )

In terms of images not showing, there could be a number of reasons for that. So when you open up your new topic please could you also share if there are any error messages when you open developer tools and a link to your gitlab project (there is info on how to do that here Creating online studies from Builder — PsychoPy v2020.2).

Thanks,
Becca