-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotExpGraphSE1.m
188 lines (139 loc) · 4.79 KB
/
plotExpGraphSE1.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
function plotExpGraphSE1(experiment_name)
% PLOTEXPGRAPHSE1 Plots rms positioning error as a function of N_p and Psi from data generated by testWACOWCmulti
% Load the experiment parameters
% run(experiment_name);
%% Files and folders
baseFileName = [ experiment_name '_data.mat' ];
resultsdir = '';
if exist(baseFileName) ~= 2
% if the file does not exist, try results/ subdir
% Folter for storing results
resultsdir = 'results/';
end
% Experimente results filename
expFilename = [ resultsdir baseFileName ];
load (expFilename);
Ns_v = prod(params.NmNp,2);
Psi_v = params.Psi_v(:);
% testresultstable = struct2table(testresults);
m_v = params.m_v;
plotBaseFn = [resultsdir experiment_name];
%%
% Test: Psi
% Filter: m
% Implicit: Np,Nm
for m = m_v
% filter the table on m
ifx = testresultstable.m==m;
filtered = testresultstable(ifx,:);
% Rearrange Psi values
% Psi values are a function of Np. Replace actual values by the ration
% Psi/Psi_min
% 1. Get the values for corresponding Phi_min
Psi_min = 0.5*acos(cos(pi./(2*filtered.Np)).^2);
% 2. Compute the ratio Psi/Psi_min
Psi_ratio = round(filtered.Psi ./ Psi_min,2);
% 3. Update table
filtered.Psi = Psi_ratio;
% Sort by Implicit and then by Test
[x ix] = sort(filtered.Np);
filtered = filtered(ix,:);
[x ix] = sort(filtered.Psi);
filtered = filtered(ix,:);
% Get the indexes for the plots (unique values for each var)
valstest = unique(filtered.Psi);
valsimpl = unique(filtered.Np);
nvalstest = numel(valstest);
nvalsimpl = numel(valsimpl);
% Plot location error
% Create the array:
plotdata = reshape(filtered.locerrrms, nvalsimpl,nvalstest);
h = figure;
plot(Psi_v,plotdata','*-')
ylim([0 1.1])
title(['location, rms error, m=' num2str(m) ', VRT=' num2str(params.validReadingThreshold) ])
ylabel('rms error/m')
xlabel('\Psi/\Psi_{min}')
legend([ repmat('N_s=',size(Ns_v)) num2str(Ns_v) ]);
filename = [ plotBaseFn '_LocRMSErr_Psi_m_' num2str(m) '.png' ];
print(filename,'-dpng');
if exist('filtered.raderrrms')
% Plot radius error
% Create the array:
plotdata = reshape(filtered.raderrrms, nvalsimpl,nvalstest);
h = figure;
plot(Psi_v,plotdata','*-')
ylim([0 Inf])
title(['radius, rms error, m=' num2str(m) ', VRT=' num2str(params.validReadingThreshold) ])
ylabel('rms error/m')
xlabel('\Psi/\Psi_{min}')
legend([ repmat('N_s=',size(params.NmNp,1),1) num2str(prod(params.NmNp,2)) ]);
filename = [ plotBaseFn '_RadRMSErr_Psi_m_' num2str(m) '.png' ]
print(filename,'-dpng')
end
end
%%
% Test: Np,Nm
% Filter: m
% Implicit: Psi
for m = m_v
% filter the table on m
ifx = testresultstable.m==m;
filtered = testresultstable(ifx,:);
% Rearrange Psi values
% Psi values are a function of Np. Replace actual values by the ratio
% Psi/Psi_min
% 1. Get the values for corresponding Phi_min
Psi_min = 0.5*acos(cos(pi./(2*filtered.Np)).^2);
% 2. Compute the ratio Psi/Psi_min
Psi_ratio = round(filtered.Psi ./ Psi_min,2);
% 3. Update table
filtered.Psi = Psi_ratio;
shortlist = Psi_ratio==1 | Psi_ratio==2 | Psi_ratio==3 | Psi_ratio==4 | Psi_ratio==5;
filtered = filtered(shortlist,:);
% Sort by Implicit and then by Test
[x ix] = sort(filtered.Psi);
filtered = filtered(ix,:);
[x ix] = sort(filtered.Np);
filtered = filtered(ix,:);
% Get the indexes for the plots (unique values for each var)
valstest = unique(filtered.Np);
valsimpl = unique(filtered.Psi);
nvalstest = numel(valstest);
nvalsimpl = numel(valsimpl);
% Plot location error
% Create the array:
plotdata = reshape(filtered.locerrrms, nvalsimpl,nvalstest);
h = figure;
plot(params.NmNp(:,2),plotdata','*-')
ylim([0 1.1])
% Handle legacy error on variable name
if isfield(params,'N_L')
params.n_L = params.N_L;
params.n_W = params.N_W;
end
title(['Positioning r.m.s. error (' ...
num2str(params.n_W) 'x' num2str(params.n_L) ') light sources' ]);
ylabel('rms error/m')
xlabel('# of parallels')
legend([ repmat('\Psi_r=',size(valsimpl)) num2str(valsimpl) ]);
grid on
filename = [ plotBaseFn '_LocRMSErr_Ns_m_' num2str(m) '.png' ];
print(filename,'-dpng')
% createfigureWACOWCpos(params.NmNp(:,2),plotdata');
if exist('filtered.raderrrms')
% Plot radius error
% Create the array:
plotdata = reshape(filtered.raderrrms, nvalsimpl,nvalstest);
h = figure;
plot(Psi_v,plotdata','*-')
ylim([0 Inf])
title(['radius, rms error, m=' num2str(m) ', VRT=' num2str(params.validReadingThreshold) ])
ylabel('rms error/m')
xlabel('# of photo-detectors')
legend([ repmat('\Psi_r=',size(Psi_v)) num2str(Psi_v) ]);
filename = [ plotBaseFn '_RadRMSErr_Ns_m_' num2str(m) '.png' ]
print(filename,'-dpng')
end
end
end