File data_analysis/@entanglement_evaluation/calculate_log_neg.m added (mode: 100644) (index 0000000..39d4c90) |
|
1 |
|
function calculate_log_neg(obj, shotnoise_ind) |
|
2 |
|
for p=1:obj.tracepairs_no |
|
3 |
|
for g=1:obj.pulse_gammas_no |
|
4 |
|
if p==shotnoise_ind |
|
5 |
|
% no dual-homo correction needed for shotnoise |
|
6 |
|
obj.logneg_corrected{p}{g} = logneg(... |
|
7 |
|
obj.pulse_CM_calibrated{p}{g}); |
|
8 |
|
else |
|
9 |
|
% dual-homo correction for log.negativity |
|
10 |
|
obj.logneg_corrected{p}{g} = logneg(... |
|
11 |
|
2*obj.pulse_CM_calibrated{p}{g}-obj.shotnoise_theory); |
|
12 |
|
end |
|
13 |
|
end |
|
14 |
|
end |
File data_analysis/@entanglement_evaluation/calibratePulsedCMs.m changed (mode: 100644) (index adc2c89..b71e416) |
... |
... |
function obj = calibratePulsedCMs(obj, varargin) |
11 |
11 |
calculate_log_neg(obj, shotnoise_ind); |
calculate_log_neg(obj, shotnoise_ind); |
12 |
12 |
calculate_physicality(obj); |
calculate_physicality(obj); |
13 |
13 |
|
|
14 |
|
function shotnoise_ind = get_shotnoise_ind(obj, varargin) |
|
15 |
|
shotnoise_ind = []; |
|
16 |
|
for k=1:2:length(varargin) |
|
17 |
|
switch varargin{k} |
|
18 |
|
case 'shotnoise_ind' |
|
19 |
|
shotnoise_ind = varargin{k+1}; |
|
20 |
|
otherwise |
|
21 |
|
error(['Unrecognized varargin-argument ', varargin{k}]); |
|
22 |
|
end |
|
23 |
|
end |
|
24 |
|
|
|
25 |
|
%% search for shotnoise among the data |
|
26 |
|
if isempty(shotnoise_ind) |
|
27 |
|
shotnoise_ind = find(obj.signal_power_muW(:,1)==0); |
|
28 |
|
assert(length(shotnoise_ind) > 0,... |
|
29 |
|
'Cannot find a set of shotnoise traces (ie one with signal_power_muW == 0)') |
|
30 |
|
assert(length(shotnoise_ind) == 1,... |
|
31 |
|
'Several sets of shotnoise traces found') |
|
32 |
|
end |
|
33 |
|
|
|
34 |
14 |
function pulse_CM_corr = correct_for_detection_imperfections(obj, shotnoise_ind) |
function pulse_CM_corr = correct_for_detection_imperfections(obj, shotnoise_ind) |
35 |
15 |
eta = obj.detection_efficiency; |
eta = obj.detection_efficiency; |
36 |
16 |
nu = obj.homodyne_visibility; |
nu = obj.homodyne_visibility; |
|
... |
... |
function calibrate_to_shotnoise(obj, pulse_CM_corrected, shotnoise_ind) |
55 |
35 |
obj.pulse_CM_calibrated{p}{g} = calibrate_cm(cm_signal, cm_shot); |
obj.pulse_CM_calibrated{p}{g} = calibrate_cm(cm_signal, cm_shot); |
56 |
36 |
end |
end |
57 |
37 |
end |
end |
58 |
|
|
|
59 |
|
function calculate_log_neg(obj, shotnoise_ind) |
|
60 |
|
for p=1:obj.tracepairs_no |
|
61 |
|
for g=1:obj.pulse_gammas_no |
|
62 |
|
if p==shotnoise_ind |
|
63 |
|
% no dual-homo correction needed for shotnoise |
|
64 |
|
obj.logneg_corrected{p}{g} = logneg(... |
|
65 |
|
obj.pulse_CM_calibrated{p}{g}); |
|
66 |
|
else |
|
67 |
|
% dual-homo correction for log.negativity |
|
68 |
|
obj.logneg_corrected{p}{g} = logneg(... |
|
69 |
|
2*obj.pulse_CM_calibrated{p}{g}-obj.shotnoise_theory); |
|
70 |
|
end |
|
71 |
|
end |
|
72 |
|
end |
|
73 |
|
|
|
74 |
|
function calculate_physicality(obj) |
|
75 |
|
for p=1:obj.tracepairs_no |
|
76 |
|
for g=1:obj.pulse_gammas_no |
|
77 |
|
obj.pulse_CM_is_physical{p}{g} = isphyscov(... |
|
78 |
|
obj.pulse_CM_calibrated{p}{g}); |
|
79 |
|
end |
|
80 |
|
end |
|
File data_analysis/@entanglement_evaluation/get_shotnoise_ind.m added (mode: 100644) (index 0000000..f79ec39) |
|
1 |
|
function shotnoise_ind = get_shotnoise_ind(obj, varargin) |
|
2 |
|
shotnoise_ind = []; |
|
3 |
|
for k=1:2:length(varargin) |
|
4 |
|
switch varargin{k} |
|
5 |
|
case 'shotnoise_ind' |
|
6 |
|
shotnoise_ind = varargin{k+1}; |
|
7 |
|
otherwise |
|
8 |
|
error(['Unrecognized varargin-argument ', varargin{k}]); |
|
9 |
|
end |
|
10 |
|
end |
|
11 |
|
|
|
12 |
|
%% search for shotnoise among the data |
|
13 |
|
if isempty(shotnoise_ind) |
|
14 |
|
shotnoise_ind = find(obj.signal_power_muW(:,1)==0); |
|
15 |
|
assert(length(shotnoise_ind) > 0,... |
|
16 |
|
'Cannot find a set of shotnoise traces (i.e. one with signal_power_muW == 0)') |
|
17 |
|
assert(length(shotnoise_ind) == 1,... |
|
18 |
|
'Several sets of shotnoise traces found') |
|
19 |
|
end |
File data_analysis/@entanglement_evaluation/trace_out.m changed (mode: 100644) (index eafeef8..7f1d004) |
... |
... |
function ev_traced = trace_out(ev, modes_to_trace, varargin) |
52 |
52 |
shotnoise_ind = get_shotnoise_ind(ev_traced, varargin{:}); |
shotnoise_ind = get_shotnoise_ind(ev_traced, varargin{:}); |
53 |
53 |
calculate_log_neg(ev_traced, shotnoise_ind); |
calculate_log_neg(ev_traced, shotnoise_ind); |
54 |
54 |
calculate_physicality(ev_traced); |
calculate_physicality(ev_traced); |
55 |
|
|
|
56 |
|
|
|
57 |
|
function calculate_log_neg(obj, shotnoise_ind) |
|
58 |
|
for p=1:obj.tracepairs_no |
|
59 |
|
for g=1:obj.pulse_gammas_no |
|
60 |
|
if p==shotnoise_ind |
|
61 |
|
% no dual-homo correction needed for shotnoise |
|
62 |
|
obj.logneg_corrected{p}{g} = logneg(... |
|
63 |
|
obj.pulse_CM_calibrated{p}{g}); |
|
64 |
|
else |
|
65 |
|
% dual-homo correction for log.negativity |
|
66 |
|
obj.logneg_corrected{p}{g} = logneg(... |
|
67 |
|
2*obj.pulse_CM_calibrated{p}{g}-obj.shotnoise_theory); |
|
68 |
|
end |
|
69 |
|
end |
|
70 |
|
end |
|
71 |
|
|
|
72 |
|
function calculate_physicality(obj) |
|
73 |
|
for p=1:obj.tracepairs_no |
|
74 |
|
for g=1:obj.pulse_gammas_no |
|
75 |
|
obj.pulse_CM_is_physical{p}{g} = isphyscov(... |
|
76 |
|
obj.pulse_CM_calibrated{p}{g}); |
|
77 |
|
end |
|
78 |
|
end |
|
79 |
|
|
|
80 |
|
function shotnoise_ind = get_shotnoise_ind(obj, varargin) |
|
81 |
|
shotnoise_ind = []; |
|
82 |
|
for k=1:2:length(varargin) |
|
83 |
|
switch varargin{k} |
|
84 |
|
case 'shotnoise_ind' |
|
85 |
|
shotnoise_ind = varargin{k+1}; |
|
86 |
|
otherwise |
|
87 |
|
error(['Unrecognized varargin-argument ', varargin{k}]); |
|
88 |
|
end |
|
89 |
|
end |
|
90 |
|
|
|
91 |
|
%% search for shotnoise among the data |
|
92 |
|
if isempty(shotnoise_ind) |
|
93 |
|
shotnoise_ind = find(obj.signal_power_muW(:,1)==0); |
|
94 |
|
assert(length(shotnoise_ind) > 0,... |
|
95 |
|
'Cannot find a set of shotnoise traces (ie one with signal_power_muW == 0)') |
|
96 |
|
assert(length(shotnoise_ind) == 1,... |
|
97 |
|
'Several sets of shotnoise traces found') |
|
98 |
|
end |
|