Adding a time variable to be displayed in the data file?
I would like to add a time variable or time stamp that corresponds to the computer's time in the data file that is
produced when running an experiment. My research team and I want to sync the time on a camera with the time on the computer, so that if something goes wrong we can accurately eliminate data from a specific time in the running experiment. Basically, I want to record the actual time certain things happen when running a file. Can I add a time variable/ stamp in the data file that won't interfere with the actual background and participant's response time of the experiment. I would appreciate any help on how I can actually implement this in my experiment. Thank You.
Comments
Hi Diane,
If the timing precision does not require subsecond timestamps you could use the datetime module. In order to do so, place an
inline_scripton every position in your experiment tree where you want to check the time.In the run phase of the script write:
And in your
loggeritem manually add the created variable to write the time along with the rest of the data.The timestamp looks like
03/27/16 16:06:15but you can alter the format by usingdatetime.strftime(). For more info check:I hope this helps!
Laurent
Hi Laurent,
Thank you so much for replying and giving me some help. I implemented your idea and I was able to get the timeA variable to show up on my data file. However, it doesn't seem to be recording the actual date or time. In the data it shows 0:00 for all the times variable timeA is logged. Is there any other settings I need to change? Can you help me figure out why it won't actually record a date and time?
Regards,
Diane
Hi Diane,
My apologies, i should've checked it before responding. Instead of the local time, i think it measured the time between to points, which is 0:00 if there is only one timestamp.
As an alternative you can use this:
The
loggershould include the variable automatically, if not, manually add it.Let me know if it works!