URL of experiment: https://run.pavlovia.org/jlslater/b-rythm
Description of the problem: I have multiple PsychoPy experiments that are linked together via the Completed URL parameter. I would like to counterbalance the order of these experiments by setting the Completed URL based on a “sequence” variable for different participants (e.g. one participant gets sequence A and is directed from Expt 1 to Expt 2 to Expt 3 whereas another gets sequence B and goes from Expt 2 to Expt 1 to Expt 3 etc).
I think I got half way there by adding a “sequence” variable to the dialog box and manually entering the name of the next task:
$“https://run.pavlovia.org/jlslater/” + expInfo[‘sequence’] + "/html/
If I enter “aud_stroop” then this successfully redirects me to the aud_stroop experiment.
But I would like to extend this so the participant is assigned a single sequence value (eg A or B) and I use something like a conditions file in each experiment to assign the appropriate next task for that sequence, and the Completed URL is populated accordingly. How would I do this?
This sounds like a cool idea (and something I haven’t implemented myself).
When I run through your experiment link there I do not get directed to an additional experiment - but receive a ‘not found’ error - please can I confirm if this is currently the case for you?
Hi! I just tried it again and it does pass me to the auditory stroop experiment if I enter “aud_stroop” as the sequence - if you enter something else it may say not found…
The participant id should not matter but it may cause a “not found” error if nothing is entered there
Aha! my apologies I had not entered information to the gui - let me play with this and get back to you. I like the idea of where this could go!
So I’ve had some developments.
In your opening experiment, say you have a field called ‘expOrder’ in your GUI and that field contains a list or possible orders fomatted like this:
Then in your ‘Completed URL’ use something like this:
Then in the following experiments the ‘Online’ tab contains something like:
How many experiments do you have that need linking? I think it is possible but might need some thinking through on how we pass variables between experiments using query strings.
Hope this helps as a start point,
Ok thanks! I will try it out tomorrow. I initially just need two different sequences (A, B, C, D and B, A, C, D) but was hoping if I could get this working I would be able to do more counterbalancing across the four experiments, without needing to maintain multiple versions of each. I will need to look at it more to see how it works, but would the split function handle distributing participants between two different orders? I am hoping to keep it as simple as possible for the participants so something like that would be great - but maybe I’m misunderstanding. As I say I’ll try it out tomorrow. Thanks again!
Can I also highlight that, an easier approach to counterbalancing would be to have the experiments contained within a single file and use loops for counterbalancing. But I can appreciate that you might want to keep experiments separate (which is why I gave the previous info).
Incase helpful though, I made a demo to show how you could counterbalance multiple tasks easily in a single file Rebecca Hirst / counterbalance_multiple_tasks_demo · GitLab
The flow in it’s most basic form would look something like this:
The nReps argument in the loop around each of your individual tasks essentially determines if that task will be presented on each iteration of the outermost loop…
The parameters of the outermost loop look like this. Now, here the conditions filename is determined by the start GUI (as you initially mentioned you would like):
Each counterbalance looks something like this, and the positioning of the 1’s controls the order in which the tasks are presented, we have a different conditions file for each group (I have only added two groups to this demo - ABCD and BCDA (the screenshot below would view the tasks in the order of ABCD):
As I say, I actually think this is an easier approach to counterbalancing than linking experiments - but it is also possible I think this because to me it is less intuitive passing information between experiments using query strings, compared with working from a single file.
Hopefully this is clearer once you have had a play with the demo. But this has inspired me to update our documentation (Blocks of trials and counterbalancing — PsychoPy v2021.2) to include this type of counterbalancing example.
Thanks! Yes I now see that creating everything in a single experiment could have been preferable (and would not eat up so many credits on Pavlovia!) - I am in this situation because different tasks were developed by different people, and I did not find a simple way to copy/paste one into another, or to merge them together. I was having difficulty even copy/pasting single routines, but even if that worked it seemed like it could involve a lot of reconstruction and re-testing to make sure everything still worked (again not helped by the fact that some of the experiments were created by someone else so I’m less familiar with how they were set up…). But if I’m missing a simpler solution for combining them, do let me know!
Yes, copying and pasting is not intuitive actually, but can be done using Experiment >copy routine and Experiment> paste routine though.
Following this thread I have actually put in a pull request to extend the documentaion for counterbalancing (online and offline) https://github.com/psychopy/psychopy/pull/3270 you may eventually see these improvements here https://www.psychopy.org/builder/blocksCounterbalance.html - thanks for inspiring these (what will hopefully be) improvements!