# Saving output files to capture all response and their times?

**URL:** https://discourse.psychopy.org/t/saving-output-files-to-capture-all-response-and-their-times/29097
**Category:** Builder
**Tags:** timing, data, csv, logfiles
**Created:** [May 12, 2022, 7:49am UTC](https://discourse.psychopy.org/t/saving-output-files-to-capture-all-response-and-their-times/29097 "2022-05-12T07:49:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![AdamCalderon](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@AdamCalderon](https://discourse.psychopy.org/u/AdamCalderon)
#### Post date: [May 12, 2022, 7:49am UTC](https://discourse.psychopy.org/t/saving-output-files-to-capture-all-response-and-their-times/29097/1 "2022-05-12T07:49:10Z")

</div>

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.

**Problem:**  
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

 ![Screen Shot 2022-05-12 at 09.12.41](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/1/3/131d0158458bff03dc40b33b0457dbc7e77b1ef1.png)

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)

 ![Screen Shot 2022-05-12 at 09.16.27](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/3/e/3ea8c9d79bf282db41a3b233c32c4c8b1d6d91ed.png)

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

**Question:**  
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.

---

<div class="post-metadata">

### Author: ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)
#### Post date: [May 12, 2022, 8:12am UTC](https://discourse.psychopy.org/t/saving-output-files-to-capture-all-response-and-their-times/29097/2 "2022-05-12T08:12:36Z")

</div>

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:

[https://www.psychopy.org/general/dataOutputs.html](https://www.psychopy.org/general/dataOutputs.html)

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.

---

<div class="post-metadata">

### Author: ![AdamCalderon](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@AdamCalderon](https://discourse.psychopy.org/u/AdamCalderon)
#### Post date: [May 12, 2022, 11:22am UTC](https://discourse.psychopy.org/t/saving-output-files-to-capture-all-response-and-their-times/29097/3 "2022-05-12T11:22:27Z")

</div>

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!

Cheers,  
Adam
