AW: AW: trigger TMS + collect responses during stimulus presentation
B de Haan
bianca.de-haan at klinikum.uni-tuebingen.de
Mon Jul 16 09:55:40 UTC 2007
Dear E-prime list,
Almost a month has passed since my last e-mail and I am still having
problems with the timing in my experiment, despite the excellent help from
Paul Groot, and I am now pretty close to (if not already past) total
desperation. I am sorry to have to keep bothering this list, but I am
completely out of ideas regarding how to solve my problem.
I am presenting a targetstimulus (mainstimulus) at a duration determined in
a preceding titration block followed by a maskstimulus (mainmask2). I want
to simultaneously repeatedly trigger a TMS stimulator via the parallel port.
So trigger pulses are sent both during presentation of the targetstimulus
and the maskstimulus, with subsequently 2 keyboard responses collected
during the maskstimulus. How many trigger pulses are sent during the
targetstimulus (and thereby how many during the maskstimulus) is determined
by the stimulus duration. In total, 5 trigger pulses are sent, one every
40ms, starting at targetstimulus onset.
The experiment (inline code attached at the end of this email, works
together with stimdisplay objects for both targetstimulus and maskstimulus
under unreferenced objects) is mostly working apart from one persistent
problem that I cannot seem to get rid of; the maskstimulus onset is
consistently delayed by approximately 2 screen refresh durations. The main
problematic consequence of this delay is that TMS trigger pulses falling in
this delay, are also delayed meaning the time between successive TMS pulses
is no longer constant. I have tried both approaches suggested by Paul in his
previous email; duration = pre-release = 0 and duration = pre-release =
targetstimulus duration. Regardless of how I combine durations and
pre-release, the onset of the maskstimulus (and thereby the offset of the
targetstimulus) is consistently delayed by about 2 screen refresh durations.
Unfortunately, in this experiment both the presentation duration of the
targetstimulus and the timing of the TMS pulses are critical.
As mentioned previously, the results from the clocktest show that my
computer is capable of millisecond precision. Moreover, during the stimulus
duration titration block (which is identical to the experimental block apart
from the TMS pulses) I have millisecond timing precision.
Does anybody have any idea of something else that I could try to get rid of
the timing delay of the maskstimulus? Any help would, as always, be greatly
appreciated.
Many thanks in advance,
Bianca de Haan
############################################################################
################################
'SCRIPT TO ENABLE TMS PULSES FROM TARGET STIMULUS ONSET
'create pulsecount to keep track of the amount of pulses fired
PulseCount = 0
'Prepare things so that first TMS pulse is sent at stimulus onset
mainstimulus.OnsetSignalEnabled = True
mainstimulus.OnsetSignalPort = &H378
mainstimulus.OnsetSignalData = &HFF
'Prepare and run mainstimulus
mainstimulus.Duration = StimDisplayDuration
mainstimulus.PreRelease = mainstimulus.Duration
mainstimulus.Filename = c.GetAttrib("mainstimulus")
mainstimulus.Load
mainstimulus.Run
c.SetAttrib "mainstimulus.OnsetDelay", mainstimulus.OnsetDelay
c.SetAttrib "mainstimulus.OnsetTime", mainstimulus.OnsetTime
c.SetAttrib "mainstimulus.PreRelease", mainstimulus.PreRelease
MainStimOnset = mainstimulus.OnsetTime
PulseCount = PulseCount + 1
'make sure exact vertical refresh is hit
sleep (0.5 * RefreshDuration)
'keep mainstimulus onscreen until stimdisplayduration has elapsed
while clock.read() < MainStimOnset + StimDisplayDuration - (0.5 *
RefreshDuration)
'as long as stimdisplayduration has not elapsed, trigger
tms every 40ms
PulseTime = MainStimOnset + ((5 * PulseCount) *
RefreshDuration)
PulseWait = PulseTime - clock.read()
WritePort &H378,0
if PulseWait <= 0 then
WritePort &H378,255
PulseCount = PulseCount + 1
c.SetAttrib "PulseTime" & PulseCount, clock.read()
end if
wend
do
loop until clock.read() >= MainStimOnset + StimDisplayDuration -
(0.5 * RefreshDuration)
'Prepare and run mainmask2
mainmask2.InputMasks.Reset
mainmask2EchoClients.RemoveAll
mainmask2.InputMasks.Add Keyboard.CreateInputMask("{ANY}", "",
CLng("-1"), CLng("2"), ebEndResponseActionNone, CLogical("Yes"), "", "",
"ResponseMode:All ProcessBackspace:Yes")
mainmask2.Duration = StimDisplayDuration
mainmask2.PreRelease = mainmask2.Duration
mainmask2.Run
'start loop that runs mainmask2 until 2 responses are collected
while firing
'remaining tms pulses
Dim StimDisplayMasks As InputMaskManager
Set StimDisplayMasks = mainmask2.InputMasks
while PulseCount < 5 And StimDisplayMasks.Item(1).Responses.Count <
2
PulseTime = MainStimOnset + ((5 * PulseCount) *
RefreshDuration)
PulseWait = PulseTime - clock.read()
WritePort &H378,0
if PulseWait <= 0 then
WritePort &H378,255
PulseCount = PulseCount + 1
c.SetAttrib "PulseTime" & PulseCount, clock.read()
end if
wend
do
loop until StimDisplayMasks.Item(1).Responses.Count = 2
'save attributes mainmask2
c.SetAttrib "resp1", StimDisplayMasks.Item(1).Responses(1).RESP
c.SetAttrib "resp2", StimDisplayMasks.Item(1).Responses(2).RESP
c.SetAttrib "mainmask2.OnsetDelay", mainmask2.OnsetDelay
c.SetAttrib "mainmask2.OnsetTime", mainmask2.OnsetTime
c.SetAttrib "mainmask2.RESP", mainmask2.RESP
'calculate real mainstimulus duration
RealTargetDuration = mainmask2.Onsettime - mainstimulus.OnsetTime
c.SetAttrib "RealTargetDuration", RealTargetDuration
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20070716/8332bcf5/attachment.htm>
More information about the Eprime
mailing list