Welcome! Log In Create A New Profile

Advanced

How to Fixate Gabor for 100 ms but Keep Eye Tracking Active for Longer Duration?

Posted by matteo123 
How to Fixate Gabor for 100 ms but Keep Eye Tracking Active for Longer Duration?
September 03, 2023 11:51AM
Hello everyone,

I'm currently working on an experiment where I'd like to present a Gabor patch for a short duration (say 100 ms), but I want the eye tracking to continue even after the Gabor has disappeared. My goal is to keep the eye tracking active for a longer duration (see the Scene 2 here in my script):
% scene 2: gabor
% define variables
wait_for_fix_gabor = 2000;
sample_time = 500;
hold_radius = 2;
gabor = 2;  % 
tracker = eye_; 

fix2_gabor = SingleTarget(null_);  % SingleTarget with no tracker, so only serves for timing
fix2_gabor.Target = gabor;

tc = TimeCounter(fix2_gabor);  % Will count time for 100 ms
tc.Duration = 100;

fix2_fix = SingleTarget(tracker);  % SingleTarget with eye tracker for actual tracking
fix2_fix.Target = gabor;
fix2_fix.Threshold = hold_radius;

wth2 = WaitThenHold(fix2_fix);
wth2.WaitTime = wait_for_fix_gabor;  % Wait time to make fixation
wth2.HoldTime = sample_time;  % The time the subject has to hold the fixation

all_gab = AllContinue(tc);
all_gab.add(wth2);

scene2 = create_scene(all_gab, gabor);  % Gabor specified here as TaskObject

The scene currently ends after 100 ms, but I want the eye tracking to continue. How can I modify the code to achieve this? Is there a way to 'turn off' the Gabor patch but continue to record eye position?

Thank you for your time and assistance.
All the best
Matteo
Re: How to Fixate Gabor for 100 ms but Keep Eye Tracking Active for Longer Duration?
September 03, 2023 04:22PM
Is 'gabor' a TaskObject? In the scene framework, the duration of a TaskObject is just the entire scene. You cannot turn it off in the middle of a scene. If it is an image file, delete it from the conditions file and create with ImageGraphic instead.

fix2_gabor = ImageGraphic(null_);
fix2_gabor.List = { 'gabor.bmp', [0 0] };
tc2 = TimeCounter(fix2_gabor);
tc2.Duration = 100;
seq = Sequential(tc2);  % This adapter runs multiple chains in a scene. Since there is no 2nd scene added, it does nothing after the 1st chain ends.. 

fix = SingleTarget(eye_);
fix.Target = [0 0];
fix.Threshold = 2;
wth = WaitThenHold(fix);
wth.WaitTime = 2000;
wth.HoldTime = 500;

con = Concurrent(wth);
con.add(seq);

scene = create_scene(con);
run_scene(scene);

If I understood correctly, the gabor is displayed for 100 ms and just disappears. It has nothing to do with fixation. So you can separate the stimulus chain and the behavior chain and combine them with Concurrent. Sequential is needed for the scene that ends early.
Re: How to Fixate Gabor for 100 ms but Keep Eye Tracking Active for Longer Duration?
September 04, 2023 11:26AM
Thank you Jaewon
Exactly, gabor is a taskobject

In the end, I have successfully obtained what I wanted by adding the 'Sequential' as in this code.

% scene 2: gabor
fix2_gabor = SingleTarget(null_);
fix2_gabor.Target = gabor;  % target is gabor
tc = TimeCounter(fix2_gabor);
tc.Duration = 100;

seq = Sequential(tc);  

fix2_fix = SingleTarget(tracker);
fix2_fix.Target = gabor;
fix2_fix.Threshold = hold_radius;

wth2 = WaitThenHold(fix2_fix);
wth2.WaitTime = wait_for_fix_gabor; % wait until fix is made      
wth2.HoldTime = sample_time;

con = Concurrent(wth2);
con.add(seq);

scene2 = create_scene(con, [gabor, fixation_point]);

In the same script, I have two buttons that are pressed during the experiment. How can I save the value of the pressed button in trialrecord? The SingleButton only returns a success status and it is not stored.

btn1 = SingleButton(button_);
btn1.Button = 1;    % 1
btn2 = SingleButton(button_);
btn2.Button = 2;    % 1

Thank you very much in advance
all the best
M
Re: How to Fixate Gabor for 100 ms but Keep Eye Tracking Active for Longer Duration?
September 04, 2023 04:32PM
If the success status is true, it means the button was pressed; otherwise, it wasn't. Plus, the button signals are recorded for the entire trial and saved in the data file. See the AnalogData field in the data.

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.