Randomizing conditions across two loops with multiple routines

OS: Win10
PsychoPy version: v2023.1.2
Standard Standalone: y

What are you trying to achieve?:
I am probably missing the answer right in front of me, but all the examples and other similar topics I have reviewed in this forum do not achieve my goal. I have two loop “blocks” of multiple routines that call on conditions from the same file, but with different formatting (see Pic 1). e.g., The first block calls on a subset of rows in a column of words that will be displayed in standard Times New Roman font; and the second block calls on a separate subset of rows in a column of letters that will be displayed in Wingdings font (because I need them to be symbols that are meaningless to the participants, but have significance to the experimenter).

I would like to have these conditions randomly display to participants across both blocks such that they might see a couple of words, then a symbol, more words, a few symbols, etc., until they have seen all rows in the two ranges provided.

What did you try to make it work?:
As suggested in this thread I created two “inner loops” of the routines where the first loop displays the routine with the desired condition and follows with routines for questions about the target stimulus. For these inner loops, I set the nReps to orders[0][AllTestTrials.thisN] and the Conditions to the spreadsheet with the conditions I want displayed (see Pic 2). I also added a code component for the beginning of the experiment to shuffle the order of the loops. I then created an “outer loop” with the nReps set to 2 and no Conditions file specified (see Pic 3).

However, this simply randomizes the presentation of the two inner loops as if I was only trying to counterbalance their order. It does not randomly pull from one “inner loop” and then the other “inner loop” as desired. So, I tried also pointing the “outer loop” to the spreadsheet where all of the conditions for the “inner loops” are included. This had no impact.

I also tried pointing the “outer loop” to a Conditions file with columns for the stimulus routines of the “inner loops” (e.g. Stimuli1 and Stimuli2) with each row having a 1 in one column and a 0 in the other, with the “inner loops” nReps set to the column names as suggested in thread.


Pic 1

image
Pic 2

image
Pic 3

I hope that I am being clear. Is it possible to shuffle the conditions across two routines in the manner that I am describing?

The proliferation of routines in your flow panel worries me a bit - this amount of duplication is usually indicative that you might be fighting against PsychoPy’s design principles more than a bit.

An example here is that I don’t think you need two blocks/loops at all (if I understand your design - it’s quite possible I’ve misinterpreted your description). If you want fonts to vary from trial, don’t do this by using multiple blocks (presumably with hardcoded font names). Instead, have just a single loop and control the font on a trial-by-trial basis from your conditions file.

i.e. if you have a column in your conditions file called text_font, then simply:

  1. Put $text_font in the “Font” field of the “Formatting” tab of your text component.
  2. Set that field’s updating to “set every repeat”.

Now the font will change from trial to trial, in a manner controlled by the structure of your conditions file and the randomisation setting in the loop dialog.

Also, the font name is now going to get recorded automatically in the data file on each row, and this will ease your analysis process.

There are almost certainly ways in which the proliferation of routines could similarly be reduced by automating more things, but we don’t know enough details to give you any pointers there. If you start by describing what you want to do, rather than the way you are currently implementing it, we might be able to suggest a much simpler arrangement, which would in turn generate you a much tidier data structure for analysis.

NB having multiple routines makes it much more difficult to analyse the data, as variables collected in each routine (like reaction times and so on) all go in their own column in the data file. Try wherever possible to use the smallest number of routines possible to carry out the stimuli and response gathering tasks on each trial.