How to randomize text (between 2 variables) for a rating task, upon visual stimuli presentation

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 1.84.x): (v2021.1.4)
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:

I’m trying to make an experiment where images are presented to the participant (30 images per category, 3 categories total) and the participant has to rate the images. So far so good. However, for this experiment to have any value I need to randomize the injunction of “what” they’re rating (“Rate the novelty of this design”, or “Rate the usefulness of this design”). For this experiment, the crucial thing I’ll be looking at is response time.

Basically, I need my experiment to present image 1, wait 6 sec, then show a rating slider and text asking to the participant to rate “novelty” or “usefulness” of the object in image 1 (and so on for the 90 items). I would like the participant to not know if for the next item, they’re going to be rating “novelty” or “usefulness”, so I would like to randomize that “injunction” (and hopefully find in my participant response files what condition did they rate each time).

I am extremely appreciative of PsychoPy and it’s builder mode. This is to say as well that I have no knowledge of python, so my question would be is there a way to make this work without working on the code and only staying on builder mode ?

What did you try to make it work?: I haven’t been able to figure out how I can randomize that text and rating aspect. So far I had made a version of the experiment (with a training phase) where half of the items (45 stimuli) were presented and asked to be rated in terms of “Novelty”, then a break, then the other half to be rated in terms of “Usefulness”. Here is the what the builder looks like :

What specifically went wrong when you tried that?: Nothing has specifically gone wrong, I just haven’t wrapped my head around how I could make this work. I’m am respectfully hoping that someone more experienced could give me an idea.

Include pasted full error message if possible. “That didn’t work” is not enough information.

Hello,

I would make an Excel sheet with two columns: image_path and feedback_question with rows of the relative path (e.g. Images/image1.jpg) and question text. Make a loop around the routine with the Excel file as conditions and voilà!
Now you add these variables, image_path and feedback_question, directly into your image and text component. This does not give complete randomness, but requires no code what so ever.

Randomness can be ensured with a simple code block and I’ll be happy to help.

Thank you very much @Filabel

I can definitely settle for this alternative that makes a lot of sense. I’ve tried it out for my training phase and it works great. Thank you for your quick response and thank you for giving me the key to finishing my experimental task.

Happy to help!

If you want to make it random, it is pretty simple. Remove the question_text column from your Excel sheet, and insert a code component above your text component.

Write the following code in the code component:

### Begin experiment
question_1 = 'Write question 1 here'
question_2 = 'Write question 2 here'

### Begin routine
random_question = randchoice([question_1, question_2])  # 50/50 chance

… and insert random_question into your text component. Remember to choose set every repeat on the right side.