Psychtoolbox(MATLAB)中有多少错过的翻转?

时间:2017-11-19 22:18:30

标签: matlab psychtoolbox

我正在MATLAB(R2014b)中使用Psychtoolbox进行反应时间实验。我正在使用SyncTests,这让我估计了在运行实验时有多少翻页命令错过了请求的响应截止时间。丢失翻转次数过多(即引起关注)?我通常每1900翻转140左右,所以略高于7%。那可以吗?

这里是我收到的消息(实际数字在每次实验运行后略有不同,自然而然):" INFO:PTB的屏幕(' Flip', 10)在本届会议期间,指令似乎已经错过了所要求的刺激演示截止日期总计1900次翻转中的130次。"

这里是我用来翻转的代码(然后测量RT,这是我代码中最重要的部分):

WaitSecs(.2); [this is the intertrial interval, more or less]
Screen('DrawTexture', mainwin, Target);
Screen('Flip', mainwin);
timeStart = GetSecs;keyIsDown=0; correct=0; rt=0;
while 1 & (GetSecs - timeStart) < 3 
      [keyIsDown, secs, keyCode] = KbCheck;
      FlushEvents('keyDown');
          if keyIsDown
                nKeys = sum(keyCode);
                if nKeys==1
                        if keyCode(Left)||keyCode(Right)||keyCode(Down)||keyCode(Up)
                            rt = 1000.*(GetSecs-timeStart);
                            keypressed=find(keyCode);
                            Screen('Flip', mainwin);
                            [etc., I just close all loops/if statements and move on
                            to the next trial]

一点背景:我在Windows 10上运行我的范例,还有一个&#34; DPI-awareness&#34;问题我无法解决(我得到一个警告,MATLAB在我的计算机上不支持DPI)。我不确定这可能造成什么问题 - 但范式似乎正在做我想要它做的事情加上看起来很棒(即图像显示得很好),所以我从来没有那么担心过。我应该吗?这可能会影响反应时间测量的准确性吗?

1 个答案:

答案 0 :(得分:0)

以下建议有点不完整,因为我没有进行剩下的实验,但我认为你会明白这一点。您应该能够通过提前安排屏幕翻转来获得更高的精确度。在这个例子中,前一个和当前刺激之间的时间被计算为帧,然后当前刺激被安排为一帧的1/2,然后你希望它被呈现。然后,Psychtoolbox将在下一个可能的帧中呈现它,这是您希望它呈现时(因为您无法在帧之间呈现视觉刺激)。

mainwin = Screen('OpenWindow');

% fetch the interflip interval of the screen
ifi = Screen('GetFlipInterval', mainwin);

% inter-trial interval
ITI = .2;

% start of block, flip a screen at an arbitrary time to get a reference
% point for the first trial
Screen('FillRect', mainwin, 0);
[~, lastVisualOnset] = Screen('Flip', mainwin);

% ID the number of frames until the next stimulus should be presented
% trial-by-trial timing jitter could also be added here if desired
nextStimFrameDelta = round( ISI / ifi);

Screen('DrawTexture', mainwin, Target);

% schedule the Flip in advance by .5 frames less than needed,
% so that the next available frame will be the one wanted
% this visual onset time stamp will then be the reference point for the
% next trial
[~, lastVisualOnset] = Screen('Flip', mainwin,  lastVisualOnset + ((nextStimFrameDelta - 0.5) * ifi));

keyIsDown=0; correct=0; rt=0;
while (GetSecs - lastVisualOnset) < 3
    [keyIsDown, secs, keyCode] = KbCheck;
    FlushEvents('keyDown');
    if keyIsDown
        nKeys = sum(keyCode);
        if nKeys==1
            if keyCode(Left)||keyCode(Right)||keyCode(Down)||keyCode(Up)
                rt = 1000.*(GetSecs-lastVisualOnset);
                keypressed=find(keyCode);
                Screen('Flip', mainwin);
            end
        end
    end
end