User`s guide
E-Prime User’s Guide
Chapter 3: Critical Timing
Page 115
However, once a common reference point is established, the two different clocks will still
eventually “drift” out of synchronization relative to each other. This timing drift is caused by
miniscule timing inaccuracies inherent in each unique hardware clock (see 3.3.1.6 Technique 6:
Rescaling clocks to match precision differences).
While the timing error in each clock is very small in magnitude, the cumulative effects of these
inaccuracies can be significant during the course of a prolonged stimulus presentation sequence.
For example, in an experiment that is doing functional Magnetic Resonance Imaging (fMRI)
recording of brain activation, the MRI scanner may be programmed to record a brain image every
1.2 seconds for 480 seconds. The experiment needs to present a stimulus as near to the time of
the start of the imaging of the brain volume as possible. If the MRI clock is 0.1% fast relative to
the E-Prime clock, then by the end of 6 minutes of recording time, the stimulus will be presented
480ms after the recording of the brain volume has begun. Since most biological recording device
manufacturers do not allow the rescaling of their clocks (even when their timing precision may
only be accurate to 0.1% relative to a known calibrated source), E-Prime provides a method to
rescale the real time clock internal to E-Prime. In general, in these types of biological studies,
alignment of events and elimination of timing drift is more important than matching the real-time
timestamps to some external real-time standard. E-Prime includes a method on the system
Clock object (Clock.Scale), which can be assigned a floating point number with 15 digits of
precision. This number is used as a scaling factor and is applied to all internal timestamps
returned by the E-Prime real-time clock (which is recording time at the microsecond level
internally).
To rescale the E-Prime clock, you must write a calibration experiment and run it in conjunction
with the external hardware in order to compute an appropriate scaling factor. The scale factor
can be established by providing some type of hardware signal between the experiment
presentation computer and the biological monitoring computer. Each computer will use the
hardware signals to time a “known” period of time and then the results can be divided to compute
the scale factor. For example, E-Prime has a WritePort command to allow the writing of values to
digital output ports (e.g., a parallel port, or register programmable digital I/O card). Using the
WritePort command, you can output a signal to an EEG recording system as a brain channel
(e.g., through a voltage divider circuit). The calibration experiment, written in E-Prime, would then
turn on the signal, wait for a long period (1000000ms, or 10 minutes 40 seconds) using
something like the Sleep command, and then turn the signal off. During this time the EEG
recording system measures the duration of the signal using its own clock. Let us assume you
received a value of 999457 from the EEG clock. The E-Prime clock may then be rescaled as
follows:
Scaling Factor = EEG Duration / E-Prime Duration
Scaling Factor = 999457 / 1000000 = 0.999457
At the beginning of the experiment you can then specify the scaling factor using E-Basic script in
an InLine object.
Clock.Scale = 0.999457
Rather than specifying this value directly in the experiment specification, it is recommended that
you design the experiment so that the clock scaling factor is loaded from some external file at
runtime (e.g., so that the experiment itself need not be regenerated should the scale factor ever
need to be changed).
When a Clock.Scale is specified, E-Prime will apply the rescaling internally from that point on in
the experiment. If an accurate scaling factor is computed and applied, the two clocks should be