Need specific stimuli file paths after they get chosen in a random loop

Hi,

so i am trying to get my head around how i can solve the following problem.

I have coded an experiment with 5 conditions. Each condition has another type of stimulus. Therefore i have 5 stimuli folders and excel files. There is also a master excel file (exponenten.xlsx) which contains the 5 excel file names in the column “Exponent”. This is the actual condition file for the loop that randomizes the order of the 5 experimental conditions (loop_Exponenten).

In each condition participants are supposed to learn 4 randomly chosen stimuli out of 20 (the targets). These are saved in an object called “targets” which gets overwritten with every iteration of the condition loop (loop_Exponenten). After the learning phase (here: “Lernphase5s”), participants are going through a testing phase, where these stimuli (targets) and new ones (foils) are presented.

After loop_Exponenten i need to show all of the targets again to let participants rate them. I tried to use .append to get the line numbers in the respective excel sheet which works partially. All 20 line numbers are saved in this list (here: alletargets). I use “alletargets” in selected rows, “Exponent” in condition and “exponenten.xlsx” in another loop around that as the condition file. So it is just the same as in the learning phase, except for selected rows.

Unfortunately, because the line numbers of my 5 excel sheets are identical, my script shows all 20 targets corresponding to “alletargets” per condition.
Instead, it should only present the 4 targets per condition which were chosen before the learning phase. So 4x5 instead of 20x5.

Is there a way to use a function like .append to not only save the line numbers but the condition as well? Or maybe another solution?

I would be very grateful if anyone has an idea how i can solve my problem. Thanks!

(Win11, PsychoPy 2023.2.3)

Hi @juliank,

Sorry, some questions for clarification: When you say “each condition has another type of stimulus”, what exactly do you mean? In what sense are these stimuli different?

Can you explain how a trial works in more detail? What exactly happens in Lernphase5s and in Lernphase2s? How many stimuli are presented during the “Lernphasen” and from what condition(s) are these? What exactly happens in the various “Testphasen”? How are the foils intermixed with the targets? What do the inner loops do? What are the participants supposed to do?

Sorry for the many questions. Feel free to share your experiment if that makes things easier.

Best wishes,
Jan

I don’t have any experience with builder, but in coder, if I need to explicitly save filenames and make sure things don’t get confused after randomization, I put them in the “name” argument

ImageStim.name=
or

frame1 = visual.ImageStim(the_screen, image="...path/348225.png", name="...path/348225.png") 

and this stays with the image object.