-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpositioningPlot.m
74 lines (61 loc) · 2.34 KB
/
positioningPlot.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% positioningPlot.m:
% This script is intended to genrate the positioning plot and the cell
% assignament of every BD, after the manual positioning in the
% filtering.m stage.
%
% REV. 1. by Eugenio Senes and Theodoros Argyropoulos
%
% Last modified 14.09.2016 by Eugenio Senes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all; clc;
%load part
expname = 'Exp_UnLoaded43MW_9';
datapath_write_plot = '/Users/esenes/swap_out/exp/plots';
datapath_write_fig = '/Users/esenes/swap_out/exp/figs';
%check if the positioning has been done
if data_struct.Analysis.positioning == 0
error('Positioning has not been done during filtering. Please come back and do it')
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% generate lists for plots
delayEdge = [];
delayCorr = [];
failCorrCount = 0;
for k = 1:length(BDs_ts)
%edge
tR = data_struct.(BDs_ts{k}).position.edge.time_REF;
tT = data_struct.(BDs_ts{k}).position.edge.time_TRA;
delayEdge = [delayEdge tR-tT];
%correlation
if data_struct.(BDs_ts{k}).position.correlation.fail == false
delC = data_struct.(BDs_ts{k}).position.correlation.delay_time;
delayCorr = [delayCorr delC];
else
failCorrCount = failCorrCount+1;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% do the actual plotting
f1 = figure;
figure(f1);
hEdge = histogram(delayEdge);
hEdge.BinWidth = 4e-9;
line([68e-9 68e-9], ylim, 'Color', 'r','LineWidth',2) %vertical line
line([-68e-9 -68e-9], ylim, 'Color', 'r','LineWidth',2) %vertical line
title('Delay edge method')
xlabel('$$t_{REF} - t_{TRA} $$ (s) ','interpreter','latex')
ylabel('Counts (arb.u.)')
savefig(f1,[datapath_write_fig filesep expname '_edge_method'])
print(f1,[datapath_write_plot filesep expname '_edge_method'],'-dpng')
f2 = figure;
figure(f2);
hCorr = histogram(delayCorr);
hCorr.BinWidth = 4e-9;
title({'Delay correlation method';['Manual fails: ' num2str(failCorrCount) ' on ' num2str(length(BDs_ts))]})
xlabel('$$t_{REF} - t_{INC} $$ (s) ','interpreter','latex')
ylabel('Counts (arb.u.)')
savefig(f2,[datapath_write_fig filesep expname '_correlation_method'])
print(f2,[datapath_write_plot filesep expname '_correlation_method'],'-dpng')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% interlock check