Millisecond Forums

How to record time - not duration - of stimulus onset?

https://forums.millisecond.com/Topic12274.aspx

By marieke_01 - 2/5/2014

Hello.

We want to supervise by video if a participant has really observed the presented stimulus. Therefore, we need the time, when the stimulus was presented.

With "stimulusonset" it´s only possible to record the milliseconds after the trail began - thus, a kind of hold-up effect control.

But we need the time - in terms of time of day (10:12:13) or the milliseconds, counted scine the beginning of the whole experiment.


Who can help?

Thank you, Marieke


By Dave - 2/5/2014

You'll want to make use of the applicable 'currenttime' and/or 'elapsedtime' property to record a timestamp /ontrialbegin, log that to the data file and then add stimulusonset to the timestamp to approximate absolute starting time for the given stimulus.
By juhaso - 4/16/2014

Thank you for the very nice possibility, to include a timestamp of the inquisit-events in the logfile via

<data>
/ colums =[...,script.currenttime,...]
</data>

However, to synchronize inquisit-events very accurately with an externally recorded video (with timestamps) it would be very useful to have a inquisit-timestamp including milliseconds, e.g., in the format hh:mm:ss:xxx where xxx are the milliseconds. Is there any possibility to have that?
By Dave - 4/16/2014

No. The currenttime property does not provide milliseconds. elapsedtime, however, is provided in milliseconds, so if need be you could conceivably combine the two (using math via expressions).
By juhaso - 4/22/2014

Actually that does not help much. If I find

script.currenttime   script.elapsedtime
12:13:23             41291
12:13:33             51391

in my logfile, I know that the trial startet at second 23 and lastet for exactly 10 seconds. However, I don't know exactly when it started. That's to unprecise to sync it with a videorecording of 30 fps which records a frame every 33 ms.

My workaround-solution is to wait for a "full" second:

------------------------------------
### Start experiment-block if second is "full"
### (Inquisit 3.0.6.0)

<expt>
/ subjects = (1 of 1)
/ blocks = [1=loopfullsecond]
</expt>

<values>
/ beginningSecond = script.currenttime
</values>

#########################
### "full second" loop
#########################

<block loopfullsecond>
/ branch = [if (script.currenttime > values.beginningSecond) block.experiment]
/ branch = [if (script.currenttime == values.beginningSecond) block.loopfullsecond]
</block>

#########################
### Experiment starts
#########################

<block experiment>
/ trials = [1=experiment]
</block>

<trial experiment>
/ stimulustimes = [0 = experiment,currenttime1,currenttime2,elapsedtime1]
/ timeout = 5000
</trial>

<text experiment>
/ items = experiment
/ valign = center
/ halign = center
/ position = (50%, 50%)
/ txcolor = (0,0,0)
/ fontstyle = ("Arial", 5%)
</text>

<text currenttime1>
/ items =  ("Script start second: <% values.beginningSecond %>")
/ position = (50%, 60%)
/ halign = center
</text>

<text currenttime2>
/ items =  ("Current time: <% script.currenttime %>")
/ position = (50%, 70%)
/ halign = center
</text>

<text elapsedtime1>
/ items = ("Elapsed time (should be lower than 1000): <% script.elapsedtime %>")
/ position = (50%, 80%)
/ halign = center
</text>

<item experiment>
/1 = "Experiment starts"
</item>
------------------------------------

The script itself seems to need about 32ms to get up and running on my machine (measured with a very simple script and script.elapsedtime). That's an offset of one frame and acceptable/assessable for me. Nevertheless, a more precise timestamp would be very useful ;-)