File data_analysis/@entanglement_evaluation/plotLogneg.m changed (mode: 100644) (index 0f29e39..fcaca8f) |
... |
... |
function fig = plotLogneg(obj, varargin) |
55 |
55 |
set(gca, 'FontSize', 11); |
set(gca, 'FontSize', 11); |
56 |
56 |
|
|
57 |
57 |
counter = 0; |
counter = 0; |
58 |
|
for k=tracepairs |
|
59 |
|
counter = counter + 1; |
|
60 |
|
x_data = obj.pulse_gammas; |
|
61 |
|
y_data = [obj.logneg_corrected{k}{:}]; |
|
62 |
|
try |
|
63 |
|
label = [num2str(obj.measurement.homotraces(k,1).signal_power_muW), ' \muW']; |
|
64 |
|
catch |
|
65 |
|
label = ''; |
|
66 |
|
end |
|
67 |
|
if isempty(linecolors) % default colors |
|
68 |
|
if show_lines |
|
69 |
|
plot(x_data, y_data, ... |
|
70 |
|
'LineWidth', linewidth, 'DisplayName', label) |
|
|
58 |
|
default_colors = cbrewer('qual', 'Dark2', max(3,numel(tracepairs))); |
|
59 |
|
if show_lines |
|
60 |
|
for k=tracepairs |
|
61 |
|
counter = counter + 1; |
|
62 |
|
x_data = obj.pulse_gammas; |
|
63 |
|
y_data = [obj.logneg_corrected{k}{:}]; |
|
64 |
|
try |
|
65 |
|
label = [num2str(obj.measurement.homotraces(k,1).signal_power_muW), ' \muW']; |
|
66 |
|
catch |
|
67 |
|
label = ''; |
71 |
68 |
end |
end |
72 |
|
else |
|
73 |
|
if show_lines |
|
74 |
|
plot(x_data, y_data, ... |
|
75 |
|
'LineWidth', linewidth, 'DisplayName', label,... |
|
76 |
|
'Color', linecolors(counter,:)) |
|
|
69 |
|
if isempty(linecolors) % default colors |
|
70 |
|
col = default_colors(counter,:); |
|
71 |
|
else |
|
72 |
|
col = linecolors(counter,:); |
77 |
73 |
end |
end |
|
74 |
|
|
|
75 |
|
plot(x_data, y_data, '.-',... |
|
76 |
|
'LineWidth', linewidth, 'DisplayName', label,... |
|
77 |
|
'Color', col) |
78 |
78 |
end |
end |
79 |
79 |
end |
end |
80 |
80 |
set(gca, 'xscale', 'log'); |
set(gca, 'xscale', 'log'); |
81 |
|
if show_legend, leg = legend('Location', 'Best'); end |
|
|
81 |
|
leg = legend('Location', 'Best'); |
82 |
82 |
xlabel('Pulse width $$\Gamma \, [\mathrm{Hz}]$$','Interpreter','latex'); |
xlabel('Pulse width $$\Gamma \, [\mathrm{Hz}]$$','Interpreter','latex'); |
83 |
83 |
ylabel('Logarithmic negativity $$E_\mathcal{N}$$','Interpreter','latex'); |
ylabel('Logarithmic negativity $$E_\mathcal{N}$$','Interpreter','latex'); |
84 |
84 |
title(tex_escape(titlestr)); |
title(tex_escape(titlestr)); |
|
... |
... |
function fig = plotLogneg(obj, varargin) |
90 |
90 |
physicality = [obj.pulse_CM_is_physical{k}{:}]; |
physicality = [obj.pulse_CM_is_physical{k}{:}]; |
91 |
91 |
lognegs = [obj.logneg_corrected{k}{:}]; |
lognegs = [obj.logneg_corrected{k}{:}]; |
92 |
92 |
lognegs(~physicality)=nan; |
lognegs(~physicality)=nan; |
93 |
|
plot(obj.pulse_gammas, lognegs,'ok'); |
|
94 |
|
end |
|
95 |
|
if show_legend |
|
96 |
|
leg_str = get(leg, 'string'); |
|
97 |
|
leg_element_no = length(leg_str); |
|
98 |
|
leg_str{leg_element_no+1} = 'Physical'; % covariance matrices'; |
|
99 |
|
leg = legend(leg_str, 'Location', 'Best'); |
|
|
93 |
|
phys_plot = plot(obj.pulse_gammas, lognegs,'ok'); |
100 |
94 |
end |
end |
|
95 |
|
leg = add_to_legend(leg, phys_plot, 'Physical'); |
101 |
96 |
end |
end |
102 |
97 |
|
|
103 |
98 |
% add info regarding maximum (over evaluated data) |
% add info regarding maximum (over evaluated data) |
|
... |
... |
function fig = plotLogneg(obj, varargin) |
109 |
104 |
y_data = [obj.logneg_corrected{k}{:}]; |
y_data = [obj.logneg_corrected{k}{:}]; |
110 |
105 |
[y_max, max_ind] = max(y_data); |
[y_max, max_ind] = max(y_data); |
111 |
106 |
x_max = x_data(max_ind); |
x_max = x_data(max_ind); |
112 |
|
if isempty(linecolors) % default colors |
|
113 |
|
col = 'k' |
|
114 |
|
else |
|
115 |
|
col = linecolors(counter,:); |
|
116 |
|
end |
|
117 |
|
plot(x_max, y_max, 's', 'Color', col, 'MarkerFaceColor', col,... |
|
118 |
|
'DisplayName', 'Maximum over evaluated data'); |
|
|
107 |
|
col = 'k'; |
|
108 |
|
max_plot = plot(x_max, y_max, 's', 'Color', col, 'MarkerFaceColor', col); |
119 |
109 |
end |
end |
|
110 |
|
leg = add_to_legend(leg, max_plot, 'Maximum over evaluated data'); |
120 |
111 |
end |
end |
121 |
112 |
|
|
122 |
113 |
% add info regarding maximum (over interpolated evaluation results) |
% add info regarding maximum (over interpolated evaluation results) |
|
... |
... |
function fig = plotLogneg(obj, varargin) |
126 |
117 |
counter = counter + 1; |
counter = counter + 1; |
127 |
118 |
y_max = obj.opt_logneg_corrected(k); |
y_max = obj.opt_logneg_corrected(k); |
128 |
119 |
x_max = obj.opt_pulse_gammas(k); |
x_max = obj.opt_pulse_gammas(k); |
129 |
|
if isempty(linecolors) % default colors |
|
130 |
|
col = 'k'; |
|
131 |
|
else |
|
132 |
|
col = linecolors(counter,:); |
|
133 |
|
end |
|
134 |
|
plot(obj.pulse_gammas_interpolated{k}, obj.logneg_corrected_interpolated{k},... |
|
135 |
|
'-.', 'Color', col, 'MarkerFaceColor', col,... |
|
136 |
|
'DisplayName', 'Interpolated evaluation results'); |
|
137 |
|
plot(x_max, y_max, 'd', 'Color', col, 'MarkerFaceColor', col,... |
|
138 |
|
'DisplayName', 'Optimum over interpolated evaluation results'); |
|
|
120 |
|
col = 'k'; |
|
121 |
|
interp_plot = plot(... |
|
122 |
|
obj.pulse_gammas_interpolated{k}, obj.logneg_corrected_interpolated{k},... |
|
123 |
|
'-.', 'Color', col, 'MarkerFaceColor', col); |
|
124 |
|
opt_plot = plot(x_max, y_max, 'd', 'Color', col, 'MarkerFaceColor', col); |
139 |
125 |
end |
end |
|
126 |
|
leg = add_to_legend(leg, interp_plot, 'Interpolated evaluation results'); |
|
127 |
|
leg = add_to_legend(leg, opt_plot, 'Optimum over interpolation'); |
140 |
128 |
end |
end |
141 |
129 |
|
|
142 |
130 |
% add line at zero |
% add line at zero |
|
... |
... |
function fig = plotLogneg(obj, varargin) |
152 |
140 |
grid on |
grid on |
153 |
141 |
end |
end |
154 |
142 |
|
|
|
143 |
|
% hide legend if not wanted |
|
144 |
|
if ~show_legend |
|
145 |
|
legend off |
|
146 |
|
end |
|
147 |
|
|
155 |
148 |
% export plots |
% export plots |
156 |
149 |
eval_folder_exists = isequal(exist(obj.evaluation_folder),7); |
eval_folder_exists = isequal(exist(obj.evaluation_folder),7); |
157 |
150 |
if save_fig |
if save_fig |
|
... |
... |
function fig = plotLogneg(obj, varargin) |
167 |
160 |
obj.evaluation_folder]) |
obj.evaluation_folder]) |
168 |
161 |
end |
end |
169 |
162 |
end |
end |
|
163 |
|
|
|
164 |
|
function leg = add_to_legend(leg, plot_handle, leg_str) |
|
165 |
|
[~,~,plot_handles,leg_strs] = legend(leg); |
|
166 |
|
plot_handles = [plot_handles; plot_handle]; |
|
167 |
|
leg_strs = {leg_strs{:}, leg_str}; |
|
168 |
|
leg = legend(plot_handles, leg_strs{:},... |
|
169 |
|
'Location', 'Best'); |