-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheckAlignment.m
64 lines (48 loc) · 1.76 KB
/
CheckAlignment.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
63
64
% Checks TTL and camera frame alignment!
function CheckAlignment(SS, ndim)
dddir = getenv('DBSDATADIR');
for subi = 1:length(SS)
SSi = SS{subi}
% Where is the Key file?
Keyfilename = [dddir '\' SSi '\' SSi '_Key'];
% Read in the Key file
Key = tdfread(Keyfilename);
nfiles = length(Key.AODepth);
disp(['Found ' num2str(nfiles) ' total files']);
for fii = 1:nfiles
fii
[ktime, ~, Warning, Plt] = Align_TTLs_And_Frames(SSi, fii, Key, ndim);
% Plot
figure(1);
% figure;
subplot(2,2,1);
plot(Plt.AO_Task_TTL_times, 'r', 'Marker', '.');
hold on;
plot(Plt.TaskConv,'b');
subplot(2,2,2);
plot(diff(Plt.AO_Task_TTL_times), 'r', 'Marker', '.');
hold on;
plot(diff(Plt.Task_TTL_times), 'b');
% How many frames before aligni?
if Plt.camAligni - (Plt.kinAligni-1) > 0
camClip = Plt.camTime(Plt.camAligni-(Plt.kinAligni-1):end);
else
camClip = [nan(1,Plt.kinAligni-Plt.camAligni) Plt.camTime];
end
figure(1);
subplot(2,2,3);
plot(camClip, 'r', 'Marker', '.');
hold on;
plot(ktime, 'b')
figure(1);
subplot(2,2,4);
plot(diff(camClip), 'r', 'Marker', '.');
hold on;
plot(diff(ktime), 'b');
sgtitle([SSi ' ' num2str(fii) '/' num2str(nfiles) Warning]);
while ~waitforbuttonpress
end
end
end
close all;
end