psychopy.org | Reference | Downloads | Github

Randomize 3 Routines Containing Scale Component

Hello,

I am using using standalone PsychoPy V.1.84.1 on OSX El Capitan V.10.11.6.

I am trying to randomize the presentation of 3 scales each in their own routine. I would like each scale to only be presented once. I have attempted to follow instructions from the first response to a post found here Google Groups. However, currently each scale is being repeated 3 times in sequential order. I am not sure where my logic is off.

I have attached a reproducible problem. Would love some help. Thank you!

randomizeScaleRoutine.csv (35 Bytes)
RandomizeScaleRoutine.psyexp (11.6 KB)

Hello.

Currently, by connecting the inner loops to the conditions file, you are setting up a conflict (both the inner and outer loops are trying to use variables from that file that have the same name). But also you are making each of the inner loops run through the entire conditions file for each single row of the outer loop. This has the end results of all three inner loops running once for every single iteration of the outer loop.

Only the outer loop should be connected to the conditions file. For each of the inner loop dialog boxes, just clear the contents of the conditions field.

i.e. it is the outer loop which randomises the rows in the conditions file and sets only one of the inner loops to run (the one with a repetition number of 1) for each row of that file.

1 Like

Hi Santiago,

Actually on reflection, there is now a much simpler way to do this. In the latest version of PsychoPy, there is no longer a need for this multiple-loop arrangement. You can have a much simpler (and hopefully more easy-to-comprehend) layout by doing this:

  • Delete all three inner loops. i.e. you will have just one loop, surrounding all three routines.
  • In each routine, insert a code component and put something like this in its Begin routine tab:
    if rep1 != 1:
        continueRoutine = False

i.e. this will prevent each routine running unless its repetition number has been set to 1 on this iteration of the outer loop. In the second and third routines, refer to rep2 or rep3 instead of rep1 as appropriate.

1 Like

Hi Michael,

Thank you so much for your prompt reply, clear explanation, and solutions. They both work!

Santi

Hi,
about the name conflict: the automatic extension of the namespace with the fields’ names of the condition file could cause unexpected/bizarre behaviors. Would it be possible to give the chance to define a tag to be prepended to the fields’ names when one loads a condition file? So if, let’s say, the fields’ names are Field1, Field2 etc, and my tag is TaskA, then I could reference the conditions’ through the names TaskAField1, TaskAField2, etc.

Luca

Hi Luca, for feature requests, I would suggest opening an issue on GitHub. Thanks.