Presenting different versions of a text

Disclaimer: totally new to PsychoPy and Python.

OS: Windows 10
PsychoPy version: 2023.2.3
Standard Standalone? (y/n): y

What are you trying to achieve?:
I am trying to set up an experiment in which participants will read 36 texts. Each text has three versions, and each participant will see only one version of a given text, and they will see said text only once. The difference between the three versions of a text is that one of the words in the text is different (e.g., a word with positive/negative/indifferent valence, to provide a straightforward example). Put differently, you could say that I have a total of 108 unique texts, which can be assigned to 3 different conditions, and I want participants to see 12 texts from each condition.

What did you try to make it work?:
I tried a bunch of things I found on the forums over the past few days, most of which I don’t remember now. I haven’t gotten any farther than importing my texts to PsychoPy and then displaying all of them in random order. But I don’t want to display all of them - only 12 texts from each condition. I’m rather lost as to what kind of code might be able to do that. I thought about using the .pop() method to remove the three versions of a text after one of them has been displayed, but I don’t know how that can be implemented (how to link them in the first place, and then how to remove them).

I’ve tried to import the texts in a few different ways (as an excel file in a loop around the trial; as a list; through pandas; also saw arrays recommended somewhere, but I couldn’t figure out how to create an array). Is there one way that works better than another?


I would greatly appreciate your help, and I hope it is clear enough what I want to do!
Thank you,
Nicholas

My approach would be to have a spreadsheet with 36 rows and the different versions in different columns. Separately I’d have a list with 12 of each of three values which I’d shuffle. Then using.pop() or [trials.thisN] I’d select a value for each sentence and use it to select which column to copy to thisSentence, which is what I’d present. I’d also need to save data to note the selected version in the data file.

Hi Carter,

Thanks a lot! I have pretty much managed to implement this and have even gotten on well with setting up other parts of the experiment. The only thing I’m unsure about is whether information about the selected version is being stored somewhere (e.g., in a data file), or whether I have to make it do that? I’m asking because I see the selected condition in the Runner, but I’m not sure if it’s actually being stored anywhere.

On a side note: How would you store the texts from the spreadsheet? I have loaded the spreadsheet and saved the different versions in three different lists. Seems to be working without any issues, but I was wondering if that was indeed what you had intended and if that is the most economic way of doing it.