Problem in collecting RT during RSVP detection task

Hi All,


I'm writing a code for execute an RSVP detection task, but I have a problem in collecting RT and accuracy.

Basically, what the code do at the moment is to present (in each trial) 16 squares: All squares are black except one which is white and is presented randomly in sequence positions from 6 to 11.

The stimulus (square) time is 133 ms, while the ISI (blank screen) is 367. Therefore the SOA is 500ms.

Participant will have to rapidly press a button (spacebar) when he/she see the white square. So I want to start collect the reaction time from the onset of the white square up to 500 ms (before the next black square appears). If participant will no respond during this time window, no reaction time is collected and accuracy is 0. Importantly, what I want is that the timing of the stimuli and the black screen doesn't change if participant press the spacebar (i.e., i don't want that the keypress determine a short ISI).


The code I usually use to record RT (and accuracy) is like this:

 [starttime]= Screen('Flip',window);

            endtime=KbQueueWait();  % Wait a Keypress

            StimTime=GetSecs;

            % while loop to show stimulus until subjects response 

            while (StimTime-starttime)<=StimTime

             [KeyIsDown, endtime, KeyCode]=KbCheck;

             if KeyIsDown

               RT= round(1000*(endtime-starttime)); %Compute reaction time in second

               PressBt=KbName(KeyCode);

               break;

             end

               if KeyCode(seenSquare)==1

                  acSquare=1;

               elseif KeyCode(seenSquare)==0

                  acSquare=0;

               end



I tried to make some changes to the code (and to use KbQueueStart, KbQueueStop...), but what I always get is that the code wait for a keypress to present the next square, or that when the key is pressed it goes to the next stimulus shortening the duration of the blank screen (ISI).

Could you help me?


Thank you very much!

Jessica


Hi Jessica,

what you Could do is just do the presentation of white square and blank screen without
any response collection, then check if there was a 'space' key response in the stimulation
interval after the visual stimulation ended, given that the key response is not supposed to
alter presentation schedule anyway.

whiteDuration being 0.1333 seconds, or maybe expressed in frames or whatever,
totalStimDuration = 0.5 etc.

spaceKey = KbName('space');
KbQueueStart;
KbQueueFlush();
startTime = Sreen('Flip', window); % Onset of white square?
% Draw black stuff...
blankStart = Screen('Flip', window, startTime + whiteDuration);
endTime = Screen('Flip', window, startTime + totalStimDuration);

% Get all first key press times since KbQueueFlush():
[~, firstPress] = KbQueueCheck();
if (firstPress(spaceKey) >= startTime) && (firstPress(spaceKey) <= startTime + totalStimDuration)
    % Valid 'space' key response within the totalStimDuration interval:
    RT = firstPress(spaceKey) - startTime;
else
    % No space press or outside response interval:
    RT = 0;
end

-mario


---In PSYCHTOOLBOX@yahoogroups.com, <jessica.galliussi@...> wrote :

Hi All,


I'm writing a code for execute an RSVP detection task, but I have a problem in collecting RT and accuracy.

Basically, what the code do at the moment is to present (in each trial) 16 squares: All squares are black except one which is white and is presented randomly in sequence positions from 6 to 11.

The stimulus (square) time is 133 ms, while the ISI (blank screen) is 367. Therefore the SOA is 500ms.

Participant will have to rapidly press a button (spacebar) when he/she see the white square. So I want to start collect the reaction time from the onset of the white square up to 500 ms (before the next black square appears). If participant will no respond during this time window, no reaction time is collected and accuracy is 0. Importantly, what I want is that the timing of the stimuli and the black screen doesn't change if participant press the spacebar (i.e., i don't want that the keypress determine a short ISI).


The code I usually use to record RT (and accuracy) is like this:

 [starttime]= Screen('Flip',window);

            endtime=KbQueueWait();  % Wait a Keypress

            StimTime=GetSecs;

            % while loop to show stimulus until subjects response 

            while (StimTime-starttime)<=StimTime

             [KeyIsDown, endtime, KeyCode]=KbCheck;

             if KeyIsDown

               RT= round(1000*(endtime-starttime)); %Compute reaction time in second

               PressBt=KbName(KeyCode);

               break;

             end

               if KeyCode(seenSquare)==1

                  acSquare=1;

               elseif KeyCode(seenSquare)==0

                  acSquare=0;

               end



I tried to make some changes to the code (and to use KbQueueStart, KbQueueStop...), but what I always get is that the code wait for a keypress to present the next square, or that when the key is pressed it goes to the next stimulus shortening the duration of the blank screen (ISI).

Could you help me?


Thank you very much!

Jessica

Hi,

I need to run a RSVP experiment, and I’m trying to implement the code suggested by Mario to collect the resposnes. However, the KbQueueStart command is giving me an error:
Error using PsychHID.

I’m using Windows 10, my “deviceIndex” according to GetKeyboardIndices is 0.

Any help would be very much appreciated.
Thanks.

Please provide the full error message, and minimal code that causes it

Hi,

I have added “PsychHID(‘KbQueueCreate’)” at the beginning of my code. Now, however, I’m getting the following error message when the code gets to KbQueueCheck:

Error using KbQueueCheck
Keyboard queue for device NaN already in use by GetChar () et al. Use of GetChar and keyboard queues is mutually exclusive!

I’ve posted this as an independent question here: Collecting responses on RSVP paradigm

Thanks in advance.

Please don’t double-post, it wastes peoples time. Closing and locking.
-mario