psychopy.org | Reference | Downloads | Github

Log File timing

Hello,

I am trying to get the exact time that the fmri ‘presses’ the 5 key when a experiment is running. When I check the times on the LOG file, they seem to start at a random number and there is no header for the time. My experiment runs for 58 seconds but the time slot goes to 86 seconds.

Hi there (and welcome to the forum!) :slight_smile:

The log file starts as fast as it can load the timing module after the Python instance begins (pretty quickly if you import psychopy before importing other things) but it can still then take quite a few seconds to get everything else loaded and settled.

In your case, from the screenshot, it looks like it takes about 26 s to load everything and present the window (the first timestamp you see)

1 Like

Is there any way to start the timer when the window opens and not when I hit run?

Not directly in the Builder (I’m assuming you’re using builder?):

  • there are too many places that users might choose to consider “time=0”
  • it’s going to be confusing for most people that the time isn’t continuous and increasing (because until your t=0 occurs the preceding log events will use the standard clock)

But it can be done with code at any particular time you like (e.g. end of a routine that waits for the first scanner pulse?):

studyClock = core.Clock()
logging.setDefaultClock(studyClock)
2 Likes

Did that work @Prashant_Patel? Can we tick “solved”? :slight_smile: