This script is due to Matt Davis (firstname.lastname@example.org).
This script is used to synchronise with an fMRI scanner.
The basic idea here is to run in <CR> mode so that the experiment is paced
by the stimulus presentation. By including the blank frame after each item
(which in combination with the stimulus display is longer than the time-out),
the experiment will run at a fixed pace (in this case, a word every 2.5
seconds). In my experience, DMDX will run very happily for a 15-20 minute
scanning run without drifting from expecting timing by more than 100ms (less
than 0.1% error).
Even this minimal error can be recorded and compensated for in the following ways:
1) In our set-up, the scanner outputs a request pulse (Bit0 on our PIO12 input) at the end of each scan. We can therefore use the start of the scanning run to synchronize the experiment to the fMRI scanner. The first 6 items are used to provide a countdown for the subject in the scanner. Since these 6 scans are discarded anyway (for technical reasons to do with T1 equilibration in MR imaging), we can avoid presenting stimuli during these dummy scans, whilst ensuring that the experiment and scanner start in sync
2) using zillion <ZIL> mode, DMDX records scanner pulses, like they were any other button press. We can therefore count scanner pulses in the output file to relate the stimulus presentation to the current scan number as well as using DMDX to measure the exact TR (repeat time) for the acquisition sequence that we are using.
3) by recording the clock on times (<RCOT>) we also have a measure of the exact time (from the start of the first experimental item) when each item was presented. We can convert this into scan numbers using information extracted from (2).
There are some other notes on how to do this on a FAQ that I wrote on using DMDX with fMRI. You can access this information here:
Some of this info is specific to Cambridge, but you may find it relevant or interesting for your purposes.
N300 <zil> <cr> <nfb>
<rcot> f37 d29 <vm 1024, 768, 768, 16, 0> <t 2000> <id
"keyboard"> <id "pio12"> <dbc 0> <dwc
0 "Waiting for Scanner.";
+3 * "VODKA" / <% 120> /;
+2 * "powder" / <% 120> /;
-501 * "GLANG" / <% 120> /;
+1 * "ANATOMY" / <% 120> /;
-503 * "MACKER" / <% 120> /;
+4 * "prize" / <% 120> /;
-504 * "avite" / <% 120> /;