I am having trouble precisely syncing the visual stim display and data acquisition. Here is my setup, I run PTB 3.0.16 with Matlab 2019a on a win10 machine. Monitor 1 connected to mini-DP port to show desktop and GUI, monitor 2 and 3 both for visual presentation, one in the animal recording booth, and one in the experimenter room, monitor2 and 3 are connected to the same monitor splitter, which connected to another mini-DP port on the same graphic card as monitor 1, all monitor refresh at 60 HZ with same color depth and resolution. Monitors 1 are set to be extended desktop to monitor2(monitor set as the primary display since it is used to present stimuli). The 3 monitor I have are a bit of old so they are connected to mini-dp ports with DVI and VGA converters. To measure the stim presentation precision, I tested a very simple code like this:
s = daq.createSession(‘ni’);
screens = Screen(‘Screens’);
screenNumber = max(screens);
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);
grey = white / 2;
[window, windowRect] = PsychImaging(‘OpenWindow’, screenNumber, black);
topPriorityLevel = MaxPriority(window);
Screen(‘FillRect’, window, [1.0,0.5;1.0,0.5;1.0,0.5],[1720,2120;880,880;2120,2520;1280,1280]);
I used a photodiode as external measurement for stim on time, signal from the photodiode and NIDAQ card both feed into same acquisition card of an open-ephys system.
The monitor shows the stimuli fine and did not throw any error. My problem is the open-ephys system shows that the signal from NIDAQ arrives about 40 ms earlier than the signal from the photodiode, I think in PTB documents, it is said screen(Flip) stops MatLab execution until the flip is over, and also how can the flip process possibly take so long?
Thanks in advance for any suggestions!