Saving output files to capture all response and their times?

Hi all,

I am currently running a neuroimaging study that contains three distinct experimental tasks, each with its own PsychoPy script. As you could imagine, this creates a variety of data points in which everything from ratings to onset and offset times of each routine must be collected.

The issue I am having is not so much with running the task themselves but with their output files. Specifically, the .csv does not capture all the trials run in each task but only captures data on one trial.

My current .CSV output file

As you can see, despite having 20 trials, it appears only information related to one trial is being collected. This type of instance is occurring for each of the three tasks I am currently are running. Nonetheless, I have found that all of my routines and data are being produced and exhibited within the .log file; however, it is inefficient as I have to extract timing data manually.

My said solution to tracking the timings of each component (essentially extracting info from the log file manually from the time start point =1.0339 to end point = 1041.9412)

Note: I have ensured that Save onset/offset times have been clicked for each component’s data section.

How can I capture all of the ratings and timing of each component for all trials run within a .csv output file?

Any insight on this would be immensely helpful. Happy to answer any questions regarding PsychoPy parameters or provide further screenshots.

Thanks for your time and attention, and apologies for my naivety, as I am new to PsychoPy.

What you want is not only possible, but of course routine and what pretty much everyone wants and needs. So no, you certainly don’t need to process log files or anything to get access to the basic variables described. I’m assuming that you haven’t run actual experimental sessions, because you would have examined the data file output first of course, so check these things before doing further testing:

  • Is the “is trials” check box selected in the loop around your trial routine? If not, PsychoPy will think the loop has some other purpose than collecting data.
  • What output file format(s) have you selected in the “data” tab of the experiment settings? (You need to select “.csv file (trial-by-trial)”.)
  • Don’t select the “Excel file” or “csv file (summaries)” options, as they attempt some form of summarisation. This leads to trial-by-trial level data being discarded, which is almost never a good idea.

If you have actually run real sessions, then it may be possible to extract the data by running a short script to process your .psydat files, and export their content to the CSV files you need (the .psydat file is essentially a freeze-dried recording of your entire experiment, but isn’t human-readable). You can see an example of such a script here:

But for convenience PsychoPy also has this function built-in to a menu, although you have to select the .psydat files manually one at a time. Switch to the “Coder” view, and then select “csv from psydat” from the “Tools” menu.

1 Like

Thank you so much, Michael, for your insights and kindness in responding; your suggestion worked, and all is functioning as intended, viz., capturing all responses and their times in a .csv output file!