Trouble with making a loop with various data parameters

Hello
I’m new to the tool Psychopy and is having some problem with it.
The version I’m using is Psychopy v3.1.2
I’m trying to build a face categorization experiment by showing two faces as cues and then giving one picture of the faces in a row after for the subjects to categorize the faces according to the two cues given before.
The conditional file is as shown below

what I want to achieve is to show two faces(Face0, Face100) and then randomized TargFace.

But I also want to randomize each block of data, too

For example when the FC0.jpg and FC100.jpg is shown as the cue, the randomized session of 10 pictures from FC0.jpg to FC75.jpg will follow. And then when the FA0.jpg and FA100.jpg is shown, the randomized session of 10 pictures from FA0.jpg to FA75.jpg will follow… and so on.

This is the flow chart for the experiment

and this is the code I wrote
in Begin Experiment

rowSelect=' ' 
cueSelect=' '

import random
i = 0

and in Begin Routine

nums = list(range(8)) 
random.shuffle(nums) #to randomize the order 

while i < 8:
    cueSelect = str(nums[i]*10+1) #to assign the randomized numbers to the excel rows 
    rowSelect = str(nums[i]*10+1) + ':' + str(nums[i]*10+10)
    i+=1

But in this code, the cue will be selected and randomized as I want it to be, but the following block of pictures will always be stuck at one block of 31:40

How to I fix this problem to get the result I want? Thank you faceCategory.xlsx (12.6 KB) faceExperiment_categorization_new.psyexp (55.1 KB)

Hi,

Sorry, just to clarify: Am I correct in assuming that the cues (e.g., FA0 and FA100) would only be shown once (at the beginning of a block), but are not going to be repeated?

Jan

Not sure I entirely follow, but I suspect what you want to do here is break your conditions file into three separate files. You work through each one separately, with the loop set to “random”.

This requires a nested-loop structure, with four conditions files: the three that come from splitting your current file up into separate blocks, and a fourth that contains just the names of those files, e.g.:

condition_file
conditions01.xlsx
conditions02.xlsx
conditions03.xlsx

The outer loop is connected to this tiny conditions file, and can be set to be “sequential” or “random” as you require. i.e. the outer loop controls which block of trials will be shown, and in what order.

The inner loop is not directly connected to a conditions file. Instead, you insert $condition_file in the “Conditions” field, so that the file to be used is controlled by the outer loop. Presumably you will want this inner loop to be set to “random”.