Hi PTB community,
I am trying to sync the timing of my screen flip stimulus with TTL outputs to a Neuralynx acquisition system. I am using a 64 bit Linux system running 16.04 with a l4.13.0-45 lowlatency kernal, Neurodrebin downloaded Psychtoolbox-3 (downloaded on 6/11/18), Matlab 2017a, an NViida Quadro graphics card and a U3 LabJack to generate TTL pulses with the code generously provided by IanA.
The script is able to open serial communication with labjack and send pulses, however, even though I have called labjack to send a pulse after the flip command, it seems like there is a 12 msec delay for when lablack sends out a TTL and the screen flips from black to white, as measured by a photodiode. The some jitter in this signal, but it is submilisecond (~0.7 msec). I just cannot figure out why it is so long. There does not seem to be a large number of frame drops, nor do I see any Timing Sync errors when running my code or opening the screen.
I have also included the code that I have been working with for troubleshooting.
Any advice will be super helpful. Thanks a bunch!
Adeeti
while ~KbCheck %&& count<numFrames
count=count+1;
% Flip the color on every frame
if mod(count,2)
boxcolor=params.white;
else
boxcolor=params.black;
end
% Draw the rect to the screen
Screen('FillRect', params.window, boxcolor, centeredRect);
% Flip to the screen
if count==1
[vbl, ~, ~, missed(count)]=Screen('Flip', params.window);
record(count,1)=vbl;
if mod(count,2)
[vbl, ~, ~, missed(count)]=Screen('Flip', params.window, vbl + (waitframes-0.5)*ifi);
record(count,1)=vbl;
lj.timedTTL(1,1); % TTL for eahc frame
else
[vbl, ~, ~, missed(count)]=Screen('Flip', params.window, vbl + (waitframes-0.5)*ifi);
record(count,1)=vbl;
end
end
end