Skip to content

Commit bcaaf0a

Browse files
committed
delete dead code and move it at the beginning
1 parent b07fba5 commit bcaaf0a

File tree

1 file changed

+43
-46
lines changed

1 file changed

+43
-46
lines changed

src/eyeTracker.m

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,38 @@
4040
%
4141
% Optional useful functions to implement in future:
4242
%
43-
% - oldlevel = Eyelink(‘Verbosity’ [,level]);
44-
%
45-
% Set level of verbosity for error/warning/status messages. ‘level’ optional, new
43+
% - Set level of verbosity for error/warning/status messages. ‘level’ optional, new
4644
% level of verbosity. ‘oldlevel’ is the old level of verbosity. The following
4745
% levels are supported: 0 = Shut up. 1 = Print errors, 2 = Print also warnings, 3
4846
% = Print also some info, 4 = Print more useful info (default), >5 = Be very
4947
% verbose (mostly for debugging the driver itself).
48+
%
49+
% oldlevel = Eyelink(‘Verbosity’ [,level]);
50+
%
51+
% - Tag the ET data outout
52+
%
53+
% Eyelink('command', 'add_file_preamble_text', 'Recorded by EyelinkToolbox demo-experiment');
54+
%
55+
% - Set parser (conservative saccade thresholds)
56+
%
57+
% Eyelink('command', 'saccade_velocity_threshold = 35');
58+
% Eyelink('command', 'saccade_acceleration_threshold = 9500');
59+
%
60+
% - Drift correction
61+
%
62+
% EyelinkDoDriftCorrection(el);
63+
%
64+
% success = EyelinkDoDriftCorrection(el);
65+
% if success~=1
66+
% Eyelink('shutdown');
67+
% cleanUp()
68+
% return;
69+
% end
70+
%
71+
% - Tag the recording, in the past caused delays during the presentation so I avoided to use it
72+
%
73+
% Eyelink('message', 'Trial 1');
74+
5075

5176

5277
if ~cfg.eyeTracker.do
@@ -66,7 +91,7 @@
6691
% and control codes (e.g. tracker state bit and Eyelink key values).
6792
el = EyelinkInitDefaults(cfg.screen.win);
6893

69-
% calibration has silver background with black targets, sound and smaller
94+
% Calibration has silver background with black targets, sound and smaller
7095
% targets
7196
el.backgroundcolour = [192 192 192, (cfg.screen.win)];
7297
el.msgfontcolour = BlackIndex(cfg.screen.win);
@@ -75,7 +100,7 @@
75100
el.calibrationtargetwidth = 0.5;
76101
el.displayCalResults = 1;
77102

78-
% call this function for changes to the calibration structure to take
103+
% Call this function for changes to the calibration structure to take
79104
% affect
80105
EyelinkUpdateDefaults(el);
81106

@@ -113,45 +138,36 @@
113138
[el.v, el.vs] = Eyelink('GetTrackerVersion');
114139
fprintf('Running experiment on a ''%s'' tracker.\n', el.vs);
115140

116-
% make sure that we get gaze data from the Eyelink
141+
% Make sure that we get gaze data from the Eyelink
117142
Eyelink('Command', 'link_sample_data = LEFT,RIGHT,GAZE,AREA');
118143

119144
%% STEP 4
120-
% SET UP TRACKER CONFIGURATION
121-
122145
% Setting the proper recording resolution, proper calibration type,
123146
% as well as the data file content;
124147

125-
Eyelink('command', 'add_file_preamble_text', 'Recorded by EyelinkToolbox demo-experiment');
126-
127148
% This command is crucial to map the gaze positions from the tracker to
128149
% screen pixel positions to determine fixation
129150
Eyelink('command', 'screen_pixel_coords = %ld %ld %ld %ld', 0, 0, 0, 0);
130151
Eyelink('message', 'DISPLAY_COORDS %ld %ld %ld %ld', 0, 0, 0, 0);
131152

132-
% set calibration type.
153+
% Set calibration type.
133154
Eyelink('command', 'calibration_type = HV5');
134155

135156
if cfg.eyeTracker.defaultCalibration
136157

137158
% Set default calibration parameters
138-
139-
140-
% you must send this command with value NO for custom calibration
141-
% you must also reset it to YES for subsequent experiments
142159
Eyelink('command', 'generate_default_targets = YES');
143160

144161
else
145-
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
146-
% CUSTOM CALIBRATION
147-
% (SET MANUALLY THE DOTS COORDINATES, HERE FOR 6 DOTS)
148162

149-
% you must send this command with value NO for custom calibration
150-
% you must also reset it to YES for subsequent experiments
163+
% Set default calibration parameters
151164
Eyelink('command', 'generate_default_targets = NO');
152165

153-
% calibration and validation target locations
154-
[width, height]=Screen('WindowSize', screenNumber);
166+
% Calibration target locations, set manually the dots
167+
% coordinates, here for 6 dots
168+
169+
% [width, height]=Screen('WindowSize', screenNumber);
170+
155171
Eyelink('command','calibration_samples = 6');
156172
Eyelink('command','calibration_sequence = 0,1,2,3,4,5');
157173
Eyelink('command','calibration_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',...
@@ -161,6 +177,7 @@
161177
128,341, ... %width*0.1,height*1/3
162178
1152,341 ); %width-width*0.1,height*1/3
163179

180+
% Validation target locations
164181
Eyelink('command','validation_samples = 5');
165182
Eyelink('command','validation_sequence = 0,1,2,3,4,5');
166183
Eyelink('command','validation_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',...
@@ -169,32 +186,15 @@
169186
640,614, ... %width/2,height*0.6
170187
128,341, ... %width*0.1,height*1/3
171188
1152,341 ); %width-width*0.1,height*1/3
172-
% % % % % % % % % % % % % % % % % % % % % % % % % % % % %
173189

174190
end
175191

176-
% % set parser (conservative saccade thresholds)
177-
% Eyelink('command', 'saccade_velocity_threshold = 35');
178-
% Eyelink('command', 'saccade_acceleration_threshold = 9500');
179-
180-
% set EDF file contents (not clear what this lines are used for)
192+
% Set EDF file contents (not clear what this lines are used for)
181193
el.vsn = regexp(el.vs, '\d', 'match'); % wont work on EL
182194

183-
% enter Eyetracker camera setup mode, calibration and validation
195+
% Enter Eyetracker camera setup mode, calibration and validation
184196
EyelinkDoTrackerSetup(el);
185197

186-
% % do a final check of calibration using driftcorrection
187-
% % You have to hit esc before return.
188-
% EyelinkDoDriftCorrection(el);
189-
190-
% % do a final check of calibration using driftcorrection
191-
% success=EyelinkDoDriftCorrection(el);
192-
% if success~=1
193-
% Eyelink('shutdown');
194-
% cleanUp()
195-
% return;
196-
% end
197-
198198
% Go back to default screen background color
199199
Screen('FillRect', cfg.screen.win, cfg.color.background);
200200
Screen('Flip', cfg.screen.win);
@@ -206,11 +206,8 @@
206206
Eyelink('Command', 'set_idle_mode');
207207
WaitSecs(0.05);
208208
Eyelink('StartRecording');
209-
% % here to tag the recording, in the past caused delays during the
210-
% % presentation so I avoided to use it
211-
% Eyelink('message',['TRIALID ',num2str(blocks),'_startTrial']);
212209

213-
% check recording status, stop display if error
210+
% Check recording status, stop display if error
214211
checkrec = Eyelink('checkrecording');
215212
if checkrec ~= 0
216213
fprintf('\nEyelink is not recording.\n\n');
@@ -219,7 +216,7 @@
219216
return
220217
end
221218

222-
% record a few samples before we actually start displaying
219+
% Record a few samples before we actually start displaying
223220
% otherwise you may lose a few msec of data
224221
WaitSecs(0.1);
225222

0 commit comments

Comments
 (0)