-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathsaccpar.m
62 lines (53 loc) · 1.92 KB
/
saccpar.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function sac = saccpar(bsac)
%-------------------------------------------------------------------
%
% FUNCTION saccpar.m
% Calculation of binocular saccade parameters;
% Please cite: Engbert, R., & Mergenthaler, K. (2006) Microsaccades
% are triggered by low retinal image slip. Proceedings of the National
% Academy of Sciences of the United States of America, 103: 7192-7197.
%
% (Version 1.0, 01 AUG 05)
%
%-------------------------------------------------------------------
%
% INPUT: binocular saccade matrix from FUNCTION binsacc.m
%
% sac(:,1:14) binocular microsaccades
%
% OUTPUT:
%
% sac(:,1:9) parameters avergaed over left and right eye data
%
%---------------------------------------------------------------------
if size(bsac,1)>0
sacr = bsac(:,1:7);
sacl = bsac(:,8:14);
% 1. Onset
a = min([sacr(:,1)'; sacl(:,1)'])';
% 2. Offset
b = max([sacr(:,2)'; sacl(:,2)'])';
% 3. Duration
DR = sacr(:,2)-sacr(:,1)+1;
DL = sacl(:,2)-sacl(:,1)+1;
D = (DR+DL)/2;
% 4. Delay between eyes
delay = sacr(:,1) - sacl(:,1);
% 5. Peak velocity
vpeak = (sacr(:,3)+sacl(:,3))/2;
% 6. Saccade distance
dist = (sqrt(sacr(:,4).^2+sacr(:,5).^2)+sqrt(sacl(:,4).^2+sacl(:,5).^2))/2;
angle1 = atan2((sacr(:,5)+sacl(:,5))/2,(sacr(:,4)+sacl(:,4))/2);
% Note added by [email protected]:
% The origin of the eye tracking coordinate system is usually in the
% upper left screen corner, not in the lower left screen corner as in a
% Cartesian coordinate system. Remember this when interpreting saccade
% angles (angle1 and angle2) that are based on the vertical movement
% component.
% 7. Saccade amplitude
ampl = (sqrt(sacr(:,6).^2+sacr(:,7).^2)+sqrt(sacl(:,6).^2+sacl(:,7).^2))/2;
angle2 = atan2((sacr(:,7)+sacl(:,7))/2,(sacr(:,6)+sacl(:,6))/2);
sac = [a b D delay vpeak dist angle1 ampl angle2];
else
sac = [];
end