Chapter 35 PsychoPy output files

PsychoPy output files contain information about the experiment, including response times and accuracies for each trial. You need these files to statistically analyse the data, which will be our focus in the upcoming labs.

The most important rule first: Never ever edit an output file. Instead, make a copy, save the copy as an Excel file and edit the Excel file. If you follow this basic rule, nothing terrible can happen.

Why should you not edit the .csv files? The .csv files contain your raw data. You must not change your raw data. If you still have your raw data, whatever goes wrong later in the analysis process, you will always be able to start from scratch.

35.1 Location of output files

  • PsychoPy puts output files in a folder called data.
    • This folder is automatically created when you first run an experiment.
    • The folder is located in the same directory as your experiment .psyexp file.
  • For each participant, there will typically be three types of files in this folder.
    • .csv files
    • .log files
    • .psydat files
  • We will only focus on the .csv files.

For the experiment you just ran:

  • Go to the data folder.
  • Open the .csv file using Excel.
    • If you’re using macOS, by default .csv files will be opened with Numbers. To change this, right-click on a .csv file, then click on “Get Info” and then on “Open with”. Now, choose Excel from the the dropdown menu and make sure to also click on “Change all”.
  • Save the .csv file as an .xlsx file.
    • Go to “File” and “Save As…”.
    • Choose “Excel Workbook (.xlsx)” as file format.

Please make sure you have the output file from your choice response time task open in Excel when you read the remainder of this chapter and make sure you can find the information described below in your output file.

35.2 The output file name

By default, this is how the output file name is constructed: <participant_ID>_<experiment_name>_<date>_<time>.csv (where the text between the angle brackets is a place-holder for the actual values)

The participant ID is what was entered in the participant field of the start-up dialogue. The experiment name can be found under Experiment settings → Basic → Experiment name. By default, this will be the name under which you saved your experiment.

You can change this file naming convention under “Experiment Settings” → “Data” → “Data filename”. Some knowledge of Python is required to change this though.

35.3 Output file basics

Note the following key pieces of information:

  • Counting in PsychoPy starts with 0. Thus, the first trial will have the number 0, not 1.
  • All times are in seconds. For example, a response time of 0.581 means that the response time was 0.581 seconds or 581 milliseconds (ms).
  • The most relevant columns are usually the response time, the accuracy and the condition (information about the condition is something that will usually come from your input file).

35.4 Output file rows

Apart from the header, each row in the output file corresponds to one trial. Rows are ordered chronologically (i.e., from first to last trial).

35.5 Output file columns

You can find the following information in the output file columns:

  • All the information from the input file.
  • Information from the start-up dialogue window (e.g., participant ID).
  • Information associated with your response component:
    • Key pressed: <name_of_your_response_component>.keys
    • Response time: <name_of_your_response_component>.rt
    • Accuracy: <name_of_your_response_component>.corr (this column will only exist if you used “Store correct”)

Make sure to locate these columns in your output file. When you have found them, answer the following questions:

  • What was your fastest RT and what was your slowest RT?
  • How many incorrect responses did you make?
  • Information about the loops:
    • Separate loops are associated with separate columns in the output file.
    • The header of these loop-specific columns will start with the name of the loop, e.g. trials.
    • Each loop will have the following columns associated with it:
      • <loopName>.thisRepN: How often has this loop been run?
      • <loopName>.thisTrialN: What is the trial number in this loop? (Resets when the loop repeats.)
      • <loopName>.thisN: What is the overall trial number? (Does not reset when the loop repeats.)
      • <loopName>.thisIndex: The line number in the input file that was used to run the experiment.
    • You will not usually need information from these columns, but they are useful for identifying loops in the output file. Here is a simplified representation of how loops can be identified in output files:

  • Information about the onset and offset of components:
    • .started: Onset time in seconds (relative to the start of the experiment).
    • .stopped: Offset time in seconds (relative to the start of the experiment).
    • Again, you will not usually need information from these columns.
  • In addition, there will be columns for date, frame rate, experiment name and PsychoPy version. You will usually not need to look at these columns.

35.6 Challenge exercise

Include 10 practice trials in your experiment and observe how the output file changes as a result of adding these.