Randomizing Different Subsets of Stimuli from an Excel File with Text Response in between

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

OS (e.g. Win10): Windows 11 Pro
PsychoPy version (e.g. 1.84.x): Psychopy 2023 -1.3.
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?:
I have 42 sentences in an Excel file that I inserted in a routine on PsychoPy. My participants will read each sentence (one at a time) and judge whether the sentence is meaningful with a key press. In every 2, 3, 4, or 5 sentences, they need to write down the last words of the sentences they have read so far. The 2-, 3-, 4- or 5-sentence sequences should be randomized. The sentences in the sets should also be randomized and each sentence should appear only once until all 42 are shown.

To summarize using the image below, I need my stimuli_experiment routine (or a possible loop there) to pick random sentences from a pool of 42 sentences (which I have inserted in the routine with an Excel file9 in sets of 2, 3, 4 or 5, and the text_resp routine should randomly interfere in every 2,3,4 or 5 sentences to demand a text response.

psychopy

What did you try to make it work?:
I tried some stuff from the builder menus but could not manage it. I then picked random sentences for 3 sets of 2,3,4 and 5 sentences (42 in total), inserted them in different routines (quite impractical I know), surrounded each routine and a text response with a loop and added an overarching loop that surrounds all routines but it took me nowhere. I’m stuck as of now, and help would be appreciated.

What specifically went wrong when you tried that?:
My loop strategy did not randomize the order of routines. This is my secondary solution by the way, my first aim is to randomly present 2,3,4 and 5 sentence sets using a loop or randomization, not inserting them in separate routines and trying to move them around.

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

Hi, based on my understanding of your task, I’ve made a minimal demo that should do the trick. Hope this helps :slight_smile:
multi sentence blocks.zip (26.7 KB)

Hi Sue, thanks a lot for the great effort. You managed to solve the biggest problem of mine with what you just suggested. I also needed sets of 5 but I think I can manage that with an Excel file and proper additions to the loops. It is also possible to randomly pick those 2, 3 ,4 and 5 sentences from my stimuli pool of 42 sentences right? That is exactly what I need. To clarify, I need the 2,3,4,5 sentence files/loops to randomly pick sentences from the pool until all 42 sentences are shown once but not more.

Ahhh the current implementation doesn’t allow that. I’ve tweaked the demo with the relevant code components to achieve what you’re wanting
multi sentence blocks 2.zip (16.0 KB)

Wow this work exactly as I wanted, I had different response options in mind but I can handle it thanks a lot you’ve been a huge help

1 Like

Hello again, is it possible to tweak the code or the logic a little more so that I can see which sentences were shown to the participants in the excel data? I tried adding correct answer information to the loops and stuff but it disrupted the randomization of text response and sentences.

Yes if you add line 9, this would save the sentences in a column called sentence_shown in the csv output

image

It worked, thanks a lot for the rescue again. I appreciate it.