35 Conditions files
🏢 Lab class
As mentioned in the previous chapter, we use conditions files (also referred to as input files) to tell PsychoPy what to change from one trial to the next. A conditions file will typically be an Excel file.1
Let’s look at an example. Please open the conditions file for the letter flanker task from the previous lab (called letter_flanker_input.xlsx and located in the same folder as the .psyexp file). This spreadsheet has seven rows and three columns:

The first row is a header row. Please note that the naming conventions for routines mentioned in Section 28.4 also apply to the header row of your conditions file:
- Use only letters, numbers, and underscores.
- Always begin with a letter.
- Keep in mind that PsychoPy is case-sensitive:
stimandStimare two different things, as arecorrAnsandcorrans.
The rows below the header row define all stimuli that you would like to present in your experiment (plus information associated with these stimuli such as correct responses). PsychoPy refers to these rows as conditions.2
The columns are what PsychoPy calls parameters. In our flanker conditions file, we have three different parameters: stim, corrAns and congruency. Parameters represent information about the conditions. For example, the parameter stim will determine which letters are presented on the screen, the parameter corrAns will determine what counts as a correct answer and the parameter congruency will determine if the trial is considered congruent, neutral or incongruent.
Note that the congruency information is not required for running the experiment, but it will be useful when analysing the data. Also, it allows you to easily check how many trials of each experimental condition you have in our conditions file. Note how this also determines the relative frequencies of experimental conditions: No matter how often we repeat the conditions file in a loop, 1/3 of trials will be incongruent, 1/3 congruent and 1/3 neutral.
You can also use .csv files.↩︎
Please note that this does not mean that these necessarily correspond to the conditions in your experiment. In our flanker conditions file, we have six rows defining stimuli, but we would usually say that we have three experimental conditions (congruent, neutral and incongruent).↩︎