-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoopScan.m
executable file
·169 lines (151 loc) · 4.02 KB
/
LoopScan.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
function [] = LoopScan(EW,down)
% Loop ScanCandidateDST on all periods.
% Produce smoothed skyplot
% OMH 27/06/2013
SharedGlobals;
if ~exist('down')
down = 0;
end
thtot = [];
phtot = [];
multot = [];
radtot = [];
ramptot = [];
timetot = [];
runtot = [];
if EW==1
pstart = 1;
pstop = 8;
else
pstart = 9;
pstop = 10;
end
down
for i=pstart:pstop
[thp php mult rad ramp run a b t] = ScanCandidateDST(i,down);
sel = find(php>0 & thp>0 & thp<=80);
%sel = find(thp<=80 & php>=270 & php<=360);
run = run(sel);
t = t(sel);
thp = thp(sel);
php = php(sel);
mult = mult(sel);
rad = rad(sel);
ramp = ramp(sel);
runtot = [runtot run];
timetot = [timetot t];
thtot = [thtot thp];
phtot = [phtot php];
multot = [multot mult];
radtot = [radtot rad];
ramptot = [ramptot ramp];
disp(sprintf('%d candidates selected in period %d.',length(thp),i))
%pause
end
figure(5)
subplot(2,1,1)
hist(thtot,15)
xlim([0 90])
xlabel('Zenith angle [deg]',labelOpts{:})
subplot(2,1,2)
hist(phtot,60)
xlim([0 360])
xlabel('Azimuth angle [deg]',labelOpts{:})
figure(12)
hold on
for i=1:9
minedge = (i-1)*10;
maxedge = i*10;
sel = find(thtot>=minedge & thtot<maxedge & thtot<80 & thtot>0);
tht(i) = mean(thtot(sel));
N(i) = length(sel);
end
errorbar(tht,N,sqrt(N), 'sk-','MarkerFaceColor','k','LineWidth',2 );
%errorbar(tht,N/N(7)*0.3425,sqrt(N)/max(N), 'sb-','MarkerFaceColor','b','LineWidth',2 );
grid on
xlim([0 90])
%ylim([0 1.9])
xlabel('Zenith angle [deg]', labelOpts{:})
ylabel('dN/d\theta [10deg^{-1}]', labelOpts{:})
disp ' '
figure(13)
hold on
N = [];
for i=1:18
minedge = (i-1)*20;
maxedge = i*20;
minsel = mod(minedge-90,360);
maxsel = mod(maxedge-90,360);
if minsel>maxsel
sel = find( (phtot>=minsel | phtot<maxsel) & thtot<80);
else
sel = find(phtot>=minsel & phtot<maxsel & thtot<80);
end
%pht(i) = mean(phtot(sel));
pht(i) = (maxedge+minedge)/2;
N(i) = length(sel);
end
errorbar(pht,N,sqrt(N), 'sr-','MarkerFaceColor','r','LineWidth',2 );
xlabel('Azimuth angle [deg]', labelOpts{:})
ylabel('dN/d\phi [40deg^{-1}]', labelOpts{:})
grid on
xlim([0 360])
figure(8)
hist(multot(multot>=5))
%xlim([5 max(multot)])
xlabel('Antenna multiplicity',labelOpts{:})
figure(200)
hist(ramptot,300)
xlabel('Amplitude Ratio', labelOpts{:})
grid on
figure(300)
subplot(2,1,1)
hist(log10(radtot),100)
xlabel('log10(Radius) [m]', labelOpts{:})
subplot(2,1,2)
semilogy(thtot,radtot,'k+')
grid on
xlabel('\theta [deg]', labelOpts{:})
ylabel('log10(Radius) [m]', labelOpts{:})
%pause
figure(4)
prepareSkyplot(4);
h = polar( phtot*DEG2RAD(1), thtot, 'k*');
set(h, 'MarkerFaceColor', 'g' );
if EW==0 % Add simulated data
simNS = load("NSsim.txt");
thetaSim = simNS(:,1);
phiSim = mod(simNS(:,2)-90,360);
end
polar( phiSim*DEG2RAD(1), thetaSim, 'r*');
t = length(phiSim);
n = length(find(phiSim<90 | phiSim>270));
w = length(find(phiSim<180));
disp ' '
disp(sprintf('Total nb of sim candidates = %d.',t))
disp(sprintf('North/South = %d/%d (%3.1f pc excess)',n,t-n,n/t*100))
disp(sprintf('West/East = %d/%d (%3.1f pc excess)',w,t-w,w/t*100))
SmoothSkyplot(thtot,phtot);
t = length(phtot);
n = length(find(phtot<90 | phtot>270));
w = length(find(phtot<180));
nw = length(find(phtot>0 & phtot<90));
sw = length(find(phtot>90 & phtot<180));
se = length(find(phtot>180 & phtot<270));
ne = length(find(phtot>270 & phtot<360));
disp(sprintf('Total nb of candidates = %d.',t))
disp(sprintf('North/South = %d/%d (%3.1f pc excess)',n,t-n,n/t*100))
disp(sprintf('West/East = %d/%d (%3.1f pc excess)',w,t-w,w/t*100))
s = w-(t-w)
s/t*100
fclose all;
filename = 'candidates.txt';
fid = fopen( filename, 'w' );
for i=1:length(timetot)
fprintf(fid,'%20d ',timetot(i));
fprintf(fid,'%3d ',runtot(i));
fprintf(fid,'%3.2f ',thtot(i));
fprintf(fid,'%3.2f ',phtot(i));
fprintf( fid, '\n' );
end
fclose(fid);