You currently have one survey that shows both feedback elements. Personally I would show the feedback itself in PsychoPy, unless the rest of the survey is different). If you want to show one of two different surveys then put both in the flow and a loop around each with a variable nReps (e.g. highFeedback for one and 1 - highFeedback for the other)
Progress bar. You are currently setting it to 0 every frame.
Thanks for these very helpful replies. The progress bar is working now! I cannot seem to make it be any colour other than white, but that’s not a major drama. (The text box border also doesn’t want to change colour.)
With the counterbalancing code, I am not entirely clear about to which routine I should add the first one (I take it this is in PsychoPy, yes? Because that is also not clear, since the instructions for Step 1 are about Pavlovia.) Do I just add a couple of basic routines at the front end and add the code to those? I have done these steps, and the code isn’t crashing (yay!), but how do I now use the group allocation to determine which feedback the participant sees?
I have changed the repository to internal - for some reason, GitLab is not allowing me to make it public.
Also, how do I use values from the survey (e.g. if they do not consent or do not pass one of the screening questions) to kick them out of the experiment? I may be able to work this out from your Survey Group demo, I think.
Ah, so you’d put all the code in a single routine at the start of the experiment? Gotcha.
I had changed the false feedback into two routines in PsychoPy. But I guess it should be simple just to use the loops as outlined above? Out of curiousity, why can’t we just used the “skip if” function in the Flow of the routine? I tried this but I got this warning:
Also, is there a reason why the TextBox border won’t display the colour I have set it to? And additionally, is there a way to change the colour of a single word within a text box? I would like the fake feedback to display the percentile in red for the lower group and green for the higher group.
OK, edited to add that I tried the above for counterbalancing and I got this error:
I have tried to set up the loops as advised above, with num.repeats set to 2-group for one and group-1 for the other. So that should equate to 1 and 0 for group 1 and 0 and 1 for group 2. I also tried this with 1-group and group repeats in case the groups are set to 0 and 1 instead of 1 and 2, but this also did not work.
Wait, I think perhaps I’m missing something in copying the code you sent.
In this code snippet,
import json, tempfile
# Get the folder containing the psyexp file
experiment_folder = os.path.dirname(os.path.abspath(__file__))
allocations_file = os.path.join(experiment_folder, "group_allocations.json")
.. is the (__file__) supposed to be the path to the experiment folder? But if the group_allocations.json is on the Pavlovia shelf, not in the folder, that wouldn’t work, would it? Also, wouldn’t Pavlovia throw an error or at least a warning if the counterbalancing code wasn’t working?
I am starting to think it might be easiest to just use your VESPR study portal. It seems that can also handle the group allocations?
This code is Python – for local use, and does nothing online. Hopefully you didn’t put it in an Auto code component.
Your warning “looks like variable x in Skip if should be set to update” is spurious and can be ignored. This is a good way of skipping normal routines, but won’t work for resource manager and survey routines (the option isn’t there). Also, note that Begin and End Routine code still gets run when a routine is skipped.
Please could you show a screenshot of how you’re trying to colour the border.
I was going to say that you can’t change the colour of an individual word in a textbox, but you now can. coloured-word [PsychoPy]
Unfortunately, this method fails on the second iteration of the loop online, so you might instead need to have two different textbox components with a conditional start
Uhhhh so you didn’t really answer my question about the path. If I give it a local path, how will it find the json file which only exists on the Pavlovia shelf?
No of course I didn’t put it in an Auto Code component, I coded it exactly as instructed in your post. But it’s not WORKING.
The local version of the experiment cannot access the shelf. It creates a local JSON file. If you are only running the experiment online you can delete the Python-only code.
No, no, I’m not using that, I’m using the code you posted above for group allocation, and I think what’s happening is it’s not creating the groups as it’s supposed to. Maybe because I didn’t enter the local file path.
I will try the above trick with Developer Tools and let you know.
Nope, sorry, it won’t let me do that, too many characters. As I told you above, I am not using the skip function in flow - sorry if that was misleading, I was just wondering if I COULD use it. I am using the code you posted in the Counterbalancing tip above, in the “Bespoke counterbalancing using the Pavlovia Shelf” method. I am wondering whether the code needs the path to my local folder, in place of where you have (__file__) in the code. It does NOT seem to be allocating any groups, which I am fairly sure is what is causing the error. I tested this by putting in a text routine printing out what group a participant is in.
EDIT: Actually!! I had a thought to look at the data! And I can see that the code DOES seem to be allocating groups, in that there’s a column called “group”, and it is either 1 or 2. There’s also a column called “GroupAllocation.started” and “GroupAllocation.stopped”, with a number between 1 and 2 for each. So the repeats for the loops should be 2-group and group-1
EDIT 2: No, the latest data I’ve managed to extract does NOT have a number for group. So the groups are not being reliably allocated. I tried entering the path for the local folder in place of the (file) variable in the code, but that also did not work. I also tried swapping out the text box with just plain text, which also makes no difference. Still the range error appears.
OK, I finally worked out the counterbalancing code. The key issue was that the Pavlovia Shelf item needed to be a list of 0s one longer than the number of groups (so [0, 0, 0]), which you said in the post to a previous person (“the code is also available from this thread”), but not in the instructions above for the Bespoke counterbalancing. Once I worked that out, the groups are being allocated, so that was indeed the source of the error above.
OK, now that my counterbalancing is sorted out, I am attempting to fix the code for the Consent. I have copied your code from the “Survey Test” demo, but I’m having trouble getting it to work correctly. Here is the code I’ve written:
surveyResponse = Participant_Info_Consent.getResponse()
if surveyResponse['block_1/Consent']:
if surveyResponse['block_1/Consent'] == 1:
continueRoutine = False
We only have one consent question (yes =1 or no = 0), so I didn’t need the len argument. However, this code just displays the dissent message whether or not I tick yes. What have I done wrong?