psychopy.org | Reference | Downloads | Github

How to log data from outside the trial loop in the csv file?

Hi,

I run a simple experiment (see screenshot) with a loop of 88 trials preceded by a welcome image and a fixation cross and followed by a fixation cross and closing image.

How can I log the data (especially the onset time and duration) of the routines that are located outside the loop in the .csv file? At the moment only the onset time is logged but without the name of the routines or their duration?

Thanks in advance,
Geneviève

1432_WarnRun1_2019_Feb_28_1432.csv (11.1 KB)

Hi @Genevieve_Allaire-Du, from the previous examples of logging data e.g., thisExp.addData("routineNameStartTime", globalClock.getTime()) what you need to do is collect some timing data at the start and end of a routine using a code component. So, one way would be to manually type in the routine name, so replace “routineName” with an actual routine name, e.g.,

#Begin routine
thisExp.addData("initialFixationStartTime", globalClock.getTime())

# End routine
thisExp.addData("initialFixationEndTime", globalClock.getTime())

Alternatively, you could use the built-in trial timer to get times relative to the start of the trial:

#Begin routine
thisExp.addData("initialFixationStartTime", t) # will always be zero

# End routine
thisExp.addData("initialFixationEndTime", t)  # will be duration of trial in seconds