-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdwCheckResults.m
103 lines (87 loc) · 2.58 KB
/
dwCheckResults.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
clear, clc
% -------------------------
% parameter
path = '~/Downloads/SarcTrackSampleVideos/Synth/Sample_10_12.avi';
% -------------------------
% average distance / frequency estimation
[fpath,fname] = fileparts(path);
load([fpath filesep fname '_fpd.mat']);
figureQSS
plot(fpd.x,fpd.y2Fit,'r'), hold on
plot(fpd.x,fpd.ySin,'g'),
plot(fpd.x,fpd.ySaw,'b'),
plot(fpd.x,fpd.ySawFit,'k'), hold off
legend('y2Fit','ySin','ySaw', 'ySawFit')
% -------------------------
% read/plot stats
% tpath = [fpath filesep fname '_DWStats2.csv'];
tpath = [fpath filesep fname '_DWStats.csv'];
T = readtable(tpath);
A = table2array(T);
if ~isempty(A)
% -------------------------
% bar plots
prms = A';
labels = cell(1,7*size(prms,2));
for i = 1:size(prms,2)
labels{i} = 'contraction time';
labels{size(prms,2)+i} = 'relaxation time';
labels{2*size(prms,2)+i} = 'offset from average';
labels{3*size(prms,2)+i} = 'min ds';
labels{4*size(prms,2)+i} = 'max ds';
labels{5*size(prms,2)+i} = 'min ds fit';
labels{6*size(prms,2)+i} = 'max ds fit';
end
figureQSS
boxplot([prms(1,:) prms(2,:) prms(3,:)],labels(1:3*size(prms,2)))
figureQSS
boxplot([prms(4,:) prms(5,:) prms(6,:) prms(7,:)],labels(3*size(prms,2)+1:end))
% -------------------------
% histograms
figureQSS
titles = {'contraction time','relaxation time','offset from average','min ds','max ds','min ds fit','max ds fit'};
for i = 1:7
subplot(1,7,i)
histogram(prms(i,:))
title(titles{i})
fprintf('median %s: %f\n', titles{i}, median(prms(i,:)));
end
fprintf('median min/max: %f\n', median(prms(4,:)./prms(5,:)));
fprintf('median min/max fit: %f\n', median(prms(6,:)./prms(7,:)));
else
msgbox('Stats table is empty.');
end
% -------------------------
% read/plot dists
tpath = [fpath filesep fname '_DWDists.csv'];
T = readtable(tpath);
A = table2array(T);
if ~isempty(A)
figure
histogram(A(:),20), title('dists')
else
msgbox('Dists table is empty.');
end
% -------------------------
% plot average fit curve
hPad = 10;
p = ones(hPad,1);
t = [p*A(1,1); A(:,1); p*A(end,1)];
at = t;
for i = 2:size(A,2)
cs = zeros(1,2*hPad);
for j = 1:2*hPad
% plot(t,'r'), hold on
u = [A(1,i)*ones(j,1); A(:,i); A(end,i)*ones(2*hPad-j,1)];
% plot(u,'g'), hold off
% pause
cs(j) = corr(t,u);
end
[~,j] = max(cs);
u = [A(1,i)*ones(j,1); A(:,i); A(end,i)*ones(2*hPad-j,1)];
% plot(t,'r'), hold on
% plot(u,'g'), hold off
% pause
at = at+u;
end
plot(at/size(A,2))