| Reference | Downloads | Github

Having to re-define conditions before each run

OS OS X Yosemite 10.10.5
PsychoPy version 1.85.3

I have a stroop task constructed with neutral stimuli consisting of colored Xs and word stimuli consisting of congruent/incongruent words+presentation color. I have a number of different loops throughout the experiment as I designed the paradigm to alternate between long vs short neutral and word stimuli blocks. Every time I run the study I have to redefine the conditions by re-selecting the condition excel files under loop properties.

I tried moving the excel files to my desktop as opposed to being in folders because I thought the paths might be too complex but the problem persists - I still have to redefine the conditions otherwise the experiment will not run. This will certainly be an issue when I’m ready to run participants in the paradigm as I won’t have time to redefine a dozen conditions.

I would appreciate insight as to how other people solved this issue and thank you for your help.

Version 2 Stroop.psyexp (58.2 KB)
neutral_stroop_condition.xlsx (26.6 KB)
newstroop.xlsx (30.4 KB)

Version 2 stroop is the psychopy file, neutral_stroop_conditions is self explanatory, and newstroop is the word conditions.

Hi, you’re kind of fighting against the way that Builder is supposed to work here.

It is unlikely that you need all of these different routines and multiple loops in series.What you should work towards is just having a couple of routines defined (e.g. one for instructions and another for the actual trials). The variation in conditions can come from having two nested loops. i.e. the inner loop corresponds to one that runs one iteration per trial. The outer loop corresponds to the different task blocks. i.e. one iteration of this outer loop runs for every block. The outer loop is connected to a simple conditions file with a column (called, say block_file), that contains a list of Excel files that the inner loop will use on each iteration. The inner loop isn’t directly connected to a conditions file. Instead, use the $block_file variable name. That way, the conditions file is automatically updated for you on every block.

The outer loop’s conditions file can also include a column that gives the instructions text for each block, so that the same instructions routine can be re-used.

Search this forum for ‘nested loops’ to get some examples.

Lastly, don’t use full absolute paths for files. If your conditions file is right next to your .psyexp file, it won’t need a path at all and can be referred to directly by its filename. If you want to tidy it away in sub-folder, you can just refer to it with a relative path like this: conditions/conditions_file.xlsx

Thank you for your help. I made this nested loop version with neutral and word blocks being set to their individual conditions files and the outer loop connecting to an excel file that has both excel paths and it is able to cycle through properly.

In terms of not using absolute paths, I put my conditions in a file called “conditions” and for the loop, wrote: conditions/neutral_stroop_conditions.xlsx for example. The file was unable to be located unless I used the direct path through the “browse” button. I also have direct paths in my outer loop’s conditions file linking it to the two other conditions excels.

What is the proper way to correctly reference just the name of the file without using the direct path so that I don’t have to update it every time I want to run the .psyexp file?

simple_stroop.psyexp (9.6 KB)

block_file.xlsx (38.8 KB)

At the moment your paths look like this:


../../../../Users/Bumble/Desktop/Yr. IV Sem. I/Honors/newstroop/newstroop.xlsx

i.e. you are referring to two different conditions files that are in two different source folders (one on your desktop and one in a subfolder off your desktop). The experiment .psyexp file itself must be in a completely different folder, which is why there is a string of .. required to get back to the root level. You need to bring all of your experiment-related files together into the same place if you are wanting to use relative file paths.

Lastly, these inner loops shouldn’t even be using paths to conditions files. They should be using a variable provided by the conditions file in the outer loop.