Welcome! Log In Create A New Profile

Advanced

RT from SingleTarget is earlier than scene start

Posted by Pawel 
RT from SingleTarget is earlier than scene start
September 08, 2025 05:35PM
Hi Jaewon,

Unless I am mistaken, I occasionally get adapter RT value to be smaller than scene start (looks like by 1-2 frame durations)

Here are relevant parts of my code:


joy_stim = SingleTarget(joy_);
joy_stim.Target = [0 0];
joy_stim.Threshold = joy_threshold_this_trial;  %succcess when within threshold

joy_stim_moved = NotAdapter(joy_stim); %success when outside threshold

joy_wth_stim = WaitThenHold(joy_stim_moved); %wait until time elapsed or joystick moves
joy_wth_stim.WaitTime = stim_on_time;
joy_wth_stim.HoldTime = 0;
%stops when joystick moved or wait time elapsed
%success if joystick moved


keep_going_stim = AllContinue(stim_hold_fix); %keep going unless fixat
keep_going_stim.add(joy_wth_stim);


also_images_stim = Concurrent(keep_going_stim);
also_images_stim.add(stimulus_emo_img);
also_images_stim.add(Gabor_img);

stim_scene = create_scene(also_images_stim);





stim_start = run_scene(stim_scene, stim_start_mk);



RT = joy_stim.Time - stim_start; %RT re stimulus onset


bhv_variable('SI', SI, ...
    'RI', RI, ...
    'RT', RT, ...
    'trial_result', trial_result, ...
    'joy_threshold_this_trial', joy_threshold_this_trial,...
    'ITI_buffer', ITI_buffer, ...
    'ITI_this_trial', ITI_this_trial);

And then in the BHV2 data RT will be occasionally (rarely) negative (see attached).

Which means that the adapter returned joystick threshold crossing time from before the scene (and thus the adapter?) started.

How is that possible? Am I making a mistake somewhere? And if not, what can be done to prevent it from happening?
Attachments:
open | download - Clipboard 1.png (37.9 KB)
Re: RT from SingleTarget is earlier than scene start
September 08, 2025 10:13PM
You did not make a mistake. You can get a negative RT, when your subject predicts the timing of a stimulus and makes a preemptive response to a very close target.

I will provide more detailed explanation later, but simply speaking, there is a gap between the scene start time and the time when a stimulus show up on the screen. If the subject makes a response during this gap, you get a negative RT because threshold crossing occurs before the stimulus onset. The length of the gap is supposed to be 1 frame, but the RT can be up to 2 frames in the negative direction, if there is a previous scene and the response was made at the last frame of the previous scene.

To prevent this from happening, set AllowEarlyFix of WaitThenHold to false. This will make the scene fail when the response is made before stimulus onset.
Re: RT from SingleTarget is earlier than scene start
September 09, 2025 02:52PM
Thank you!

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.