File data_analysis/@meta_ev/meta_ev.m changed (mode: 100644) (index 638ab76..930a2fc) |
... |
... |
classdef meta_ev < class_conveniences |
11 |
11 |
param_names@cell % cell array of parameter names (read from meta_data_file) |
param_names@cell % cell array of parameter names (read from meta_data_file) |
12 |
12 |
params@cell % cell array of parameter arrays (params{1} corresponds to param_names{1}) |
params@cell % cell array of parameter arrays (params{1} corresponds to param_names{1}) |
13 |
13 |
gridtype % string: 'vector' or 'matrix' describing type of grid |
gridtype % string: 'vector' or 'matrix' describing type of grid |
|
14 |
|
meta_label = '' % string describing the evaluation (could be 'traced_out_2' e.g.) |
14 |
15 |
end |
end |
15 |
16 |
properties(Dependent) |
properties(Dependent) |
16 |
17 |
dimensions@double vector % dimensions of evaluations-vector or -matrix |
dimensions@double vector % dimensions of evaluations-vector or -matrix |
|
... |
... |
classdef meta_ev < class_conveniences |
30 |
31 |
opt_logneg_corrected_interp_private@cell = {} % ... to avoid unnecessary recomputation ... |
opt_logneg_corrected_interp_private@cell = {} % ... to avoid unnecessary recomputation ... |
31 |
32 |
opt_pulse_gammas_interp_private@cell = {} % ... to avoid unnecessary recomputation ... |
opt_pulse_gammas_interp_private@cell = {} % ... to avoid unnecessary recomputation ... |
32 |
33 |
common_private@struct = struct() % ... to avoid unnecessary recomputation ... |
common_private@struct = struct() % ... to avoid unnecessary recomputation ... |
|
34 |
|
ln_fig = [] % figure handle for internally generated plot logneg vs gamma |
|
35 |
|
ln_cont_fig = [] % figure handle for internally generated contour plot of opt. logneg |
|
36 |
|
pw_cont_fig = [] % figure handle for internally generated contour plot of opt. pulse width |
33 |
37 |
end |
end |
34 |
38 |
methods |
methods |
35 |
39 |
%%% CONSTRUCTOR %%% |
%%% CONSTRUCTOR %%% |
|
... |
... |
classdef meta_ev < class_conveniences |
74 |
78 |
end |
end |
75 |
79 |
|
|
76 |
80 |
function plot_logneg_versus_gamma(meta, tracepairs_ind) |
function plot_logneg_versus_gamma(meta, tracepairs_ind) |
77 |
|
fig = figure; |
|
|
81 |
|
meta.ln_fig = figure; |
78 |
82 |
cmap = cbrewer('qual', 'Set1', meta.evaluations_no); |
cmap = cbrewer('qual', 'Set1', meta.evaluations_no); |
79 |
83 |
myplotlogneg = @(ev, color_ind) ev.plotLogneg('figure', fig,... |
myplotlogneg = @(ev, color_ind) ev.plotLogneg('figure', fig,... |
80 |
84 |
'tracepairs', tracepairs_ind, 'save_fig', false, ... |
'tracepairs', tracepairs_ind, 'save_fig', false, ... |
|
... |
... |
classdef meta_ev < class_conveniences |
85 |
89 |
myplotlogneg(meta.evaluations{k}, k) |
myplotlogneg(meta.evaluations{k}, k) |
86 |
90 |
end |
end |
87 |
91 |
end |
end |
88 |
|
function fig = contour_plot_logneg(meta, tracepairs_ind) |
|
|
92 |
|
function contour_plot_logneg(meta, tracepairs_ind) |
89 |
93 |
assertEqual(meta.gridtype,'matrix',... |
assertEqual(meta.gridtype,'matrix',... |
90 |
94 |
'only implemented for gridtype "matrix"') |
'only implemented for gridtype "matrix"') |
91 |
|
|
|
92 |
95 |
z_data = meta.opt_logneg_corrected_interp{tracepairs_ind}; |
z_data = meta.opt_logneg_corrected_interp{tracepairs_ind}; |
|
96 |
|
display_name = 'Max. log. negativity'; |
|
97 |
|
|
93 |
98 |
abs_max = ceil(10*max(max(abs(z_data))))/10; |
abs_max = ceil(10*max(max(abs(z_data))))/10; |
|
99 |
|
c_axis_lims = [-abs_max,abs_max]; |
94 |
100 |
c_levels = [-abs_max:0.1:abs_max]; |
c_levels = [-abs_max:0.1:abs_max]; |
|
101 |
|
|
95 |
102 |
cmap = flipud(cbrewer('div','RdBu',512)); |
cmap = flipud(cbrewer('div','RdBu',512)); |
96 |
|
fig = meta.my_contour_plot(z_data,... |
|
97 |
|
c_levels, 'Max. log. negativity', cmap); |
|
98 |
|
colormap(cmap); caxis([-abs_max,abs_max]) |
|
|
103 |
|
meta.ln_cont_fig = meta.my_contour_plot(z_data,... |
|
104 |
|
c_levels, display_name, cmap, c_axis_lims); |
99 |
105 |
end |
end |
100 |
106 |
function set_default_sample_no(meta, default_sample_no) |
function set_default_sample_no(meta, default_sample_no) |
101 |
107 |
for k=1:meta.evaluations_no |
for k=1:meta.evaluations_no |
|
... |
... |
classdef meta_ev < class_conveniences |
105 |
111 |
end |
end |
106 |
112 |
end |
end |
107 |
113 |
end |
end |
|
114 |
|
function save_figs(meta) |
|
115 |
|
meta.my_save_fig(meta.ln_fig, 'ln_versus_gamma'); |
|
116 |
|
meta.my_save_fig(meta.ln_cont_fig, 'lnopt'); |
|
117 |
|
meta.my_save_fig(meta.pw_cont_fig, 'pwopt'); |
|
118 |
|
end |
108 |
119 |
|
|
109 |
120 |
%% GETTERS |
%% GETTERS |
110 |
121 |
function dimensions = get.dimensions(meta) |
function dimensions = get.dimensions(meta) |
|
... |
... |
classdef meta_ev < class_conveniences |
206 |
217 |
meta.opt_pulse_gammas_interp_private = {}; |
meta.opt_pulse_gammas_interp_private = {}; |
207 |
218 |
meta.common_private = struct(); |
meta.common_private = struct(); |
208 |
219 |
end |
end |
209 |
|
function ln_or_pw_interp = interpolate_ln_pw(meta, ln_or_pw) |
|
|
220 |
|
function ln_or_pw_interp = interpolate_ln_pw(meta, ln_or_pw, varargin) |
|
221 |
|
refinement_factor = 6; |
|
222 |
|
if length(varargin)>0 |
|
223 |
|
refinement_factor = varargin{1}; |
|
224 |
|
end |
210 |
225 |
switch meta.gridtype |
switch meta.gridtype |
211 |
226 |
case 'vector' |
case 'vector' |
212 |
227 |
error('not implemented') |
error('not implemented') |
213 |
228 |
case 'matrix' |
case 'matrix' |
214 |
|
refinement_factor = 8; |
|
215 |
229 |
X = meta.params{1}; |
X = meta.params{1}; |
216 |
230 |
Xq = interp2(X,refinement_factor); |
Xq = interp2(X,refinement_factor); |
217 |
231 |
meta.params_interp{1} = Xq; |
meta.params_interp{1} = Xq; |
|
... |
... |
classdef meta_ev < class_conveniences |
221 |
235 |
ln_or_pw_interp = interp2(X,Y,ln_or_pw,Xq,Yq,'splines'); |
ln_or_pw_interp = interp2(X,Y,ln_or_pw,Xq,Yq,'splines'); |
222 |
236 |
end |
end |
223 |
237 |
end |
end |
224 |
|
function fig = my_contour_plot(meta, z_data, c_levels, display_name, cmap) |
|
|
238 |
|
function fig = my_contour_plot(meta, z_data, c_levels, display_name, cmap, c_axis_lims) |
|
239 |
|
%%% contour plot |
225 |
240 |
[x_data, y_data] = meta.params_interp{:}; |
[x_data, y_data] = meta.params_interp{:}; |
226 |
241 |
fig = figure; hold all |
fig = figure; hold all |
227 |
242 |
[c_data, c_handles] = contourf(x_data, y_data, z_data,... |
[c_data, c_handles] = contourf(x_data, y_data, z_data,... |
228 |
243 |
c_levels, 'DisplayName', display_name); |
c_levels, 'DisplayName', display_name); |
|
244 |
|
colormap(cmap); caxis(c_axis_lims); |
|
245 |
|
|
|
246 |
|
%%% cosmetics |
|
247 |
|
xlabel (meta.param_names{1}, 'Interpreter','latex'); |
|
248 |
|
ylabel(meta.param_names{2}, 'Interpreter','latex'); |
|
249 |
|
% set(gca, 'yscale', 'lin', 'xscale', 'log') |
|
250 |
|
grid |
|
251 |
|
leg = legend('Location', 'NorthOutside'); |
|
252 |
|
set(leg, 'Color', 'w', 'FontWeight', 'normal', 'LineWidth', 1, 'Interpreter', 'latex') |
|
253 |
|
|
229 |
254 |
%%% scatter plot of simulated data points |
%%% scatter plot of simulated data points |
230 |
255 |
set(gca, 'layer', 'top') |
set(gca, 'layer', 'top') |
231 |
256 |
scatter(meta.params{1}(:), meta.params{2}(:), 'xk',... |
scatter(meta.params{1}(:), meta.params{2}(:), 'xk',... |
232 |
257 |
'MarkerFaceColor','none',... |
'MarkerFaceColor','none',... |
233 |
258 |
'LineWidth',1,... |
'LineWidth',1,... |
234 |
259 |
'DisplayName', 'Simulated data points') |
'DisplayName', 'Simulated data points') |
235 |
|
%%% cosmetics |
|
236 |
|
xlabel (meta.param_names{1}, 'Interpreter','latex'); |
|
237 |
|
ylabel(meta.param_names{2}, 'Interpreter','latex'); |
|
238 |
|
% set(gca, 'yscale', 'lin', 'xscale', 'log') |
|
239 |
|
grid |
|
240 |
|
leg = legend('Location', 'Best'); |
|
241 |
|
set(leg, 'Color', 'none', 'FontWeight', 'normal', 'LineWidth', 1, 'Interpreter', 'latex') |
|
|
260 |
|
leg = legend('Location', 'NorthOutside'); |
242 |
261 |
|
|
243 |
262 |
%%% contour labels |
%%% contour labels |
244 |
263 |
text_handle = clabel(c_data, 'FontSize', 13); |
text_handle = clabel(c_data, 'FontSize', 13); |
|
... |
... |
classdef meta_ev < class_conveniences |
263 |
282 |
end |
end |
264 |
283 |
end |
end |
265 |
284 |
end |
end |
|
285 |
|
function my_save_fig(meta, fig_handle, fig_name) |
|
286 |
|
if ~isempty(fig_handle) |
|
287 |
|
fig_path = fullfile(meta.common_path, [fig_name, '__', meta.meta_label]); |
|
288 |
|
disp(['saving figures to ', fig_path, ' .fig / .pdf']) |
|
289 |
|
saveas(fig_handle, fig_path, 'fig'); |
|
290 |
|
saveas(fig_handle, fig_path, 'pdf'); |
|
291 |
|
end |
|
292 |
|
end |
266 |
293 |
end |
end |
267 |
294 |
end |
end |