Skip to content

Commit b07fba5

Browse files
committed
add boolean for calibration type
1 parent eb9a399 commit b07fba5

File tree

1 file changed

+67
-57
lines changed

1 file changed

+67
-57
lines changed

src/eyeTracker.m

Lines changed: 67 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
% Eyelink already initialized!
2-
% Running experiment on a 'EYELINK CL 4.56 ' tracker.
3-
% Error in function Open: Usage error
4-
% Could not find *any* audio hardware on your system - or at least not with the provided deviceid, if any!
5-
% Error in function FillRect: Invalid Window (or Texture) Index provided: It doesn't correspond to an open window or texture.
2+
% Running experiment on a 'EYELINK CL 4.56 ' tracker.
3+
% Error in function Open: Usage error
4+
% Could not find *any* audio hardware on your system - or at least not with
5+
% the provided deviceid, if any!
6+
% Error in function FillRect: Invalid Window (or Texture) Index provided:
7+
% It doesn't correspond to an open window or texture.
68
% Did you close it accidentally via Screen('Close') or Screen('CloseAll') ?
7-
% EYELINK: WARNING! PsychEyelinkCallRuntime() Failed to call eyelink runtime callback function PsychEyelinkDispatchCallback [rc = 1]!
8-
% EYELINK: WARNING! Make sure that function is on your Matlab/Octave path and properly initialized.
9-
% EYELINK: WARNING! May also be an error during execution of that function. Type ple at command prompt for error messages.
10-
% EYELINK: WARNING! Auto-Disabling all callbacks to the runtime environment for safety reasons.
11-
% Eyelink: In PsychEyelink_get_input_key(): Error condition detected: Trying to send TERMINATE_KEY abort keycode!
12-
13-
% Eyelink: In PsychEyelink_get_input_key(): Error condition detected: Trying to send TERMINATE_KEY abort keycode!
14-
% Error in function FillRect: Invalid Window (or Texture) Index provided: It doesn't correspond to an open window or texture.
9+
% EYELINK: WARNING! PsychEyelinkCallRuntime() Failed to call eyelink runtime
10+
% callback function PsychEyelinkDispatchCallback [rc = 1]!
11+
% EYELINK: WARNING! Make sure that function is on your Matlab/Octave path and
12+
% properly initialized.
13+
% EYELINK: WARNING! May also be an error during execution of that function.
14+
% Type ple at command prompt for error messages.
15+
% EYELINK: WARNING! Auto-Disabling all callbacks to the runtime environment
16+
% for safety reasons.
17+
% Eyelink: In PsychEyelink_get_input_key(): Error condition detected: Trying
18+
% to send TERMINATE_KEY abort keycode!
19+
% Eyelink: In PsychEyelink_get_input_key(): Error condition detected: Trying
20+
% to send TERMINATE_KEY abort keycode!
21+
% Error in function FillRect: Invalid Window (or Texture) Index provided:
22+
% It doesn't correspond to an open window or texture.
1523
% Did you close it accidentally via Screen('Close') or Screen('CloseAll') ?
1624
% Error using Screen
1725
% Usage:
1826
%
1927
% Screen('FillRect', windowPtr [,color] [,rect] )
2028
%
2129
% Error in eyeTracker (line 150)
22-
% Screen('FillRect', cfg.screen.win, [0 0 0]);
30+
% Screen('FillRect', cfg.screen.win, [0 0 0]);
2331
%
2432
% Error in visualLocTanslational (line 52)
25-
% [el] = eyeTracker('Calibration', cfg);
33+
% [el] = eyeTracker('Calibration', cfg);
34+
2635

2736
function [el, edfFile] = eyeTracker(input, cfg, varargin)
2837
% [el, edfFile] = eyeTracker(input, cfg, varargin)
2938
%
39+
% Mosto of the comments with explanation (e.g. 'STEP #') come from `EyelinkEventExample.m`
40+
%
3041
% Optional useful functions to implement in future:
3142
%
3243
% - oldlevel = Eyelink(‘Verbosity’ [,level]);
@@ -77,8 +88,7 @@
7788
if ELinit ~= 0
7889
fprintf('Eyelink is not initialized, aborted.\n');
7990
Eyelink('Shutdown');
80-
Screen('CloseAll');
81-
return
91+
CleanUp()
8292
end
8393

8494
% Make sure EL is still connected: returns 1 if connected, -1 if dummy-connected,
@@ -87,14 +97,13 @@
8797
if ELconnection ~= 1
8898
fprintf('Eyelink is not connected, aborted.\n');
8999
Eyelink('Shutdown');
90-
Screen('CloseAll');
91-
return
100+
CleanUp()
92101
end
93102

94103
% Last check that the EL is up to work
95104
if ~EyelinkInit(0, 1)
96105
fprintf('Eyelink Init aborted.\n');
97-
return
106+
CleanUp()
98107
end
99108

100109
% Open the edf file to write the data
@@ -120,48 +129,49 @@
120129
Eyelink('command', 'screen_pixel_coords = %ld %ld %ld %ld', 0, 0, 0, 0);
121130
Eyelink('message', 'DISPLAY_COORDS %ld %ld %ld %ld', 0, 0, 0, 0);
122131

123-
if cfg.eyeTracker.defaultCalibration
124-
125-
end
126-
127-
% Set default calibration parameters
128132
% set calibration type.
129133
Eyelink('command', 'calibration_type = HV5');
130134

131-
% you must send this command with value NO for custom calibration
132-
% you must also reset it to YES for subsequent experiments
133-
Eyelink('command', 'generate_default_targets = YES');
135+
if cfg.eyeTracker.defaultCalibration
134136

135-
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
136-
%
137-
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
138-
% % CUSTOM CALIBRATION
139-
% % (SET MANUALLY THE DOTS COORDINATES, HERE FOR 6 DOTS)
140-
% Eyelink('command', 'calibration_type = HV5');
141-
% % you must send this command with value NO for custom calibration
142-
% % you must also reset it to YES for subsequent experiments
143-
% Eyelink('command', 'generate_default_targets = NO');
144-
%
145-
% % calibration and validation target locations
146-
% [width, height]=Screen('WindowSize', screenNumber);
147-
% Eyelink('command','calibration_samples = 6');
148-
% Eyelink('command','calibration_sequence = 0,1,2,3,4,5');
149-
% Eyelink('command','calibration_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',...
150-
% 640,512, ... %width/2,height/2
151-
% 640,102, ... %width/2,height*0.1
152-
% 640,614, ... %width/2,height*0.6
153-
% 128,341, ... %width*0.1,height*1/3
154-
% 1152,341 ); %width-width*0.1,height*1/3
155-
%
156-
% Eyelink('command','validation_samples = 5');
157-
% Eyelink('command','validation_sequence = 0,1,2,3,4,5');
158-
% Eyelink('command','validation_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',...
159-
% 640,512, ... %width/2,height/2
160-
% 640,102, ... %width/2,height*0.1
161-
% 640,614, ... %width/2,height*0.6
162-
% 128,341, ... %width*0.1,height*1/3
163-
% 1152,341 ); %width-width*0.1,height*1/3
164-
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
137+
% 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
142+
Eyelink('command', 'generate_default_targets = YES');
143+
144+
else
145+
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
146+
% CUSTOM CALIBRATION
147+
% (SET MANUALLY THE DOTS COORDINATES, HERE FOR 6 DOTS)
148+
149+
% you must send this command with value NO for custom calibration
150+
% you must also reset it to YES for subsequent experiments
151+
Eyelink('command', 'generate_default_targets = NO');
152+
153+
% calibration and validation target locations
154+
[width, height]=Screen('WindowSize', screenNumber);
155+
Eyelink('command','calibration_samples = 6');
156+
Eyelink('command','calibration_sequence = 0,1,2,3,4,5');
157+
Eyelink('command','calibration_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',...
158+
640,512, ... %width/2,height/2
159+
640,102, ... %width/2,height*0.1
160+
640,614, ... %width/2,height*0.6
161+
128,341, ... %width*0.1,height*1/3
162+
1152,341 ); %width-width*0.1,height*1/3
163+
164+
Eyelink('command','validation_samples = 5');
165+
Eyelink('command','validation_sequence = 0,1,2,3,4,5');
166+
Eyelink('command','validation_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',...
167+
640,512, ... %width/2,height/2
168+
640,102, ... %width/2,height*0.1
169+
640,614, ... %width/2,height*0.6
170+
128,341, ... %width*0.1,height*1/3
171+
1152,341 ); %width-width*0.1,height*1/3
172+
% % % % % % % % % % % % % % % % % % % % % % % % % % % % %
173+
174+
end
165175

166176
% % set parser (conservative saccade thresholds)
167177
% Eyelink('command', 'saccade_velocity_threshold = 35');

0 commit comments

Comments
 (0)