-
Notifications
You must be signed in to change notification settings - Fork 1
/
ContoursInspectEyes.m
56 lines (48 loc) · 1.64 KB
/
ContoursInspectEyes.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
function ContoursInspectEyes(sessionname,fixX,fixY,gHalf,fHalf,hor,ver)
%ContoursInspectEyes Plot eye traces with fix and Gabor windows
% ContoursInspectEyes(sessionname,fixX,fixY,gHalf,fHalf,hor,ver)
% get list of files
filelist = nptDir([sessionname '.0*']);
numTrials = size(filelist,1);
% calculate the axis limits
xmin = 0.9 * fixX;
xmax = fixX * 1.5;
ymin = fixY * 0.5;
ymax = fixY * 1.5;
trial = 1;
while trial<=numTrials
filename = [sessionname '.' num2str(trial,'%04i')];
fprintf('Reading %s\n',filename);
[eyedata,numChannels,samplingRate,dataType,points] = nptReadDataFile(filename);
hold off
plot(eyedata(hor,:),eyedata(ver,:))
hold on
% draw Gabor window
line([fixX-gHalf fixX+gHalf],[fixY+gHalf fixY+gHalf],'Color',[1 0 0])
line([fixX-gHalf fixX+gHalf],[fixY-gHalf fixY-gHalf],'Color',[1 0 0])
line([fixX+gHalf fixX+gHalf],[fixY-gHalf fixY+gHalf],'Color',[1 0 0])
line([fixX-gHalf fixX-gHalf],[fixY-gHalf fixY+gHalf],'Color',[1 0 0])
% draw fix window on eye traces
% line([fixX-fHalf fixX+fHalf],[fixY+fHalf fixY+fHalf],'Color',[0 1 0])
% line([fixX-fHalf fixX+fHalf],[fixY-fHalf fixY-fHalf],'Color',[0 1 0])
% line([fixX+fHalf fixX+fHalf],[fixY-fHalf fixY+fHalf],'Color',[0 1 0])
% line([fixX-fHalf fixX-fHalf],[fixY-fHalf fixY+fHalf],'Color',[0 1 0])
axis([xmin xmax ymin ymax])
% get keyboard input to see what to do next
key = input('RETURN - Next Trial; p - Previous trial; N - Trial N; q - Quit: ','s');
n = str2num(key);
if strcmp(key,'p')
trial = trial - 1;
if trial<1
trial = 1;
end
elseif strcmp(key,'q')
return;
elseif ~isempty(n)
if n>0 & n<=numTrials
trial = n;
end
else
trial = trial + 1;
end
end