0001 function sa_raw_plot_ja(start_date,end_date)
0002
0003 save_dir='/home/johannesa/cbass_analysis/raw_plots';
0004 save_path = [save_dir,'/',start_date]
0005 plot_vis='off';
0006
0007
0008 d = read_arcSouth(start_date,end_date);
0009 az=d.antenna0.servo.az;
0010 el=d.antenna0.servo.el;
0011
0012
0013 utc=d.antenna0.servo.utcFast;
0014 utcMed=d.antenna0.servo.utc;
0015 utcSlow=d.array.frame.utc;
0016
0017
0018 utc_diff=d.antenna0.servo.utcFast(1:end-1);
0019
0020
0021 fast_az_err=d.antenna0.servo.fast_az_err;
0022 fast_el_err=d.antenna0.servo.fast_el_err;
0023
0024
0025 airTemperature=d.array.weather.airTemperature;
0026 pressure=d.array.weather.pressure;
0027 relativeHumidity=d.array.weather.relativeHumidity;
0028 windSpeed=d.array.weather.windSpeed;
0029 windDirection=d.array.weather.windDirection;
0030
0031
0032 features=d.array.frame.features;
0033
0034
0035
0036
0037 chan_start = 8;
0038 chan_stop = 61;
0039 nchan = chan_stop-chan_start+1;
0040
0041
0042
0043
0044 ll_r1=mean(d.antenna0.roach1.LL(:,chan_start:chan_stop),2);
0045 ll_r2=mean(d.antenna0.roach2.LL(:,chan_start:chan_stop),2);
0046
0047 rr_r1=mean(d.antenna0.roach1.RR(:,chan_start:chan_stop),2);
0048 rr_r2=mean(d.antenna0.roach2.RR(:,chan_start:chan_stop),2);
0049
0050 q_r1=mean(d.antenna0.roach1.Q(:,chan_start:chan_stop),2);
0051 q_r2=mean(d.antenna0.roach2.Q(:,chan_start:chan_stop),2);
0052
0053 u_r1=mean(d.antenna0.roach1.U(:,chan_start:chan_stop),2);
0054 u_r2=mean(d.antenna0.roach2.U(:,chan_start:chan_stop),2);
0055
0056 load1_r1= mean(d.antenna0.roach1.load1(:,chan_start:chan_stop),2);
0057 load1_r2= mean(d.antenna0.roach2.load1(:,chan_start:chan_stop),2);
0058
0059 load2_r1=mean(d.antenna0.roach1.load2(:,chan_start:chan_stop),2);
0060 load2_r2=mean(d.antenna0.roach2.load2(:,chan_start:chan_stop),2);
0061
0062
0063
0064
0065 [year, month, day, hour, minute, second] = mjd2date(utc);
0066 date=[year, month, day, hour, minute, second];
0067 Plotdate=datenum(date);
0068
0069
0070 [year, month, day, hour, minute, second] = mjd2date(utcSlow);
0071 date=[year, month, day, hour, minute, second];
0072 PlotdateSlow=datenum(date);
0073
0074
0075 [year, month, day, hour, minute, second] = mjd2date(utcMed);
0076 date=[year, month, day, hour, minute, second];
0077 PlotdateMed=datenum(date);
0078
0079
0080 [year, month, day, hour, minute, second] = mjd2date(utc_diff);
0081 date=[year, month, day, hour, minute, second];
0082 Plotdate_diff=datenum(date);
0083
0084
0085 time_array1 = (d.antenna0.roach1.utc-d.antenna0.roach1.utc(1))*24*3600;
0086 time_array2 = (d.antenna0.roach2.utc-d.antenna0.roach2.utc(1))*24*3600;
0087 time_array3 = (d.antenna0.servo.utcFast-d.antenna0.servo.utcFast(1))*24*3600;
0088
0089
0090 inter1 = diff(time_array1);
0091 inter2 = diff(time_array2);
0092
0093
0094 hFig = figure;
0095 set(hFig, 'Visible', plot_vis);
0096
0097
0098
0099 set(hFig, 'PaperPosition', [0 0 50 150]);
0100
0101
0102 nrows = 12;
0103 ncols = 2;
0104
0105
0106 set(hFig,'DefaultAxesColorOrder',jet(nchan))
0107
0108 subplot(nrows,ncols,1)
0109
0110 med = median(d.antenna0.roach1.load1(:,chan_start:chan_stop),2);
0111 st = std(d.antenna0.roach1.load1(:,chan_start:chan_stop),0,2);
0112 scale_factor = 6;
0113 ymin_R1_L1 = mean(med)-(mean(st)*scale_factor);
0114 ymax_R1_L1 = mean(med)+(mean(st)*scale_factor);
0115
0116
0117 A1_L = min(d.antenna0.roach1.load1(:,chan_start:chan_stop));
0118 B1_L = max(d.antenna0.roach1.load1(:,chan_start:chan_stop));
0119 C1_L = find(A1_L>ymax_R1_L1 & B1_L>ymax_R1_L1);
0120 D1_L = find(A1_L<ymin_R1_L1 & B1_L<ymin_R1_L1);
0121 Z = [C1_L,D1_L]
0122 off_chan = ['off-scaled channels:' ,num2str(Z)];
0123
0124
0125 plot(Plotdate,d.antenna0.roach1.load1(:,chan_start:chan_stop))
0126 ylim([ymin_R1_L1 ymax_R1_L1])
0127 hold on;
0128 h1=plot(Plotdate,load1_r1,'-k','LineWidth',2);
0129 title({'ROACH1 Load1 (R-Circular Polarisation)',off_chan})
0130 legend(h1,'Load1Average')
0131 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0132 hold off;
0133
0134 subplot(nrows,ncols,2)
0135 med = median(d.antenna0.roach2.load1(:,chan_start:chan_stop),2);
0136 st = std(d.antenna0.roach2.load1(:,chan_start:chan_stop),0,2);
0137 scale_factor = 6;
0138 ymin_R2_L1 = mean(med)-(mean(st)*scale_factor);
0139 ymax_R2_L1 = mean(med)+(mean(st)*scale_factor);
0140 A2_L = min(d.antenna0.roach2.load1(:,chan_start:chan_stop));
0141 B2_L = max(d.antenna0.roach2.load1(:,chan_start:chan_stop));
0142 C2_L = find(A2_L>ymax_R2_L1 & B2_L>ymax_R2_L1);
0143 D2_L = find(A2_L<ymin_R2_L1 & B2_L<ymin_R2_L1);
0144 Z = [C2_L,D2_L]
0145 off_chan = ['off-scaled channels:' ,num2str(Z)];
0146 plot(Plotdate,d.antenna0.roach2.load1(:,chan_start:chan_stop))
0147 ylim([ymin_R2_L1 ymax_R2_L1])
0148 hold on;
0149 h1=plot(Plotdate,load1_r2,'-k','LineWidth',2);
0150 title({'ROACH2 Load1 (R-Circular Polarisation)',off_chan})
0151 legend(h1,'Load1Average')
0152 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0153 hold off;
0154
0155 subplot(nrows,ncols,3)
0156 med = median(d.antenna0.roach1.load2(:,chan_start:chan_stop),2);
0157 st = std(d.antenna0.roach1.load2(:,chan_start:chan_stop),0,2);
0158 scale_factor = 6;
0159 ymin_R1_L2 = mean(med)-(mean(st)*scale_factor);
0160 ymax_R1_L2 = mean(med)+(mean(st)*scale_factor);
0161 A1_L = min(d.antenna0.roach1.load2(:,chan_start:chan_stop));
0162 B1_L = max(d.antenna0.roach1.load2(:,chan_start:chan_stop));
0163 C1_L = find(A1_L>ymax_R1_L2 & B1_L>ymax_R1_L2);
0164 D1_L = find(A1_L<ymin_R1_L2 & B1_L<ymin_R1_L2);
0165 Z = [C1_L,D1_L]
0166 off_chan = ['off-scaled channels:' ,num2str(Z)];
0167 plot(Plotdate,d.antenna0.roach1.load2(:,chan_start:chan_stop))
0168 ylim([ymin_R1_L2 ymax_R1_L2])
0169 hold on;
0170 h1=plot(Plotdate,load2_r1,'-k','LineWidth',2);
0171 title({'ROACH1 Load2 (L-Circular polarisation)',off_chan})
0172 legend(h1,'Load2Average')
0173 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0174 hold off;
0175
0176 subplot(nrows,ncols,4)
0177 med = median(d.antenna0.roach2.load2(:,chan_start:chan_stop),2);
0178 st = std(d.antenna0.roach2.load2(:,chan_start:chan_stop),0,2);
0179 scale_factor = 6;
0180 ymin_R2_L2 = mean(med)-(mean(st)*scale_factor);
0181 ymax_R2_L2 = mean(med)+(mean(st)*scale_factor);
0182 A2_L = min(d.antenna0.roach2.load2(:,chan_start:chan_stop));
0183 B2_L = max(d.antenna0.roach2.load2(:,chan_start:chan_stop));
0184 C2_L = find(A2_L>ymax_R2_L2 & B2_L>ymax_R2_L2);
0185 D2_L = find(A2_L<ymin_R2_L2 & B2_L<ymin_R2_L2);
0186 Z = [C2_L,D2_L]
0187 off_chan = ['off-scaled channels:' ,num2str(Z)];
0188 plot(Plotdate,d.antenna0.roach2.load2(:,chan_start:chan_stop))
0189 ylim([ymin_R2_L2 ymax_R2_L2])
0190 hold on;
0191 h1=plot(Plotdate,load2_r2,'-k','LineWidth',2);
0192 title({'ROACH2 Load2 (L-Circular Polarisation)',off_chan})
0193 legend(h1,'Load2Average')
0194 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0195 hold off;
0196
0197 subplot(nrows,ncols,5)
0198 med = median(d.antenna0.roach1.LL(:,chan_start:chan_stop),2);
0199 st = std(d.antenna0.roach1.LL(:,chan_start:chan_stop),0,2);
0200 scale_factor = 6;
0201 ymin_LL_1 = mean(med)-(mean(st)*scale_factor);
0202 ymax_LL_1 = mean(med)+(mean(st)*scale_factor);
0203 A1_LL = min(d.antenna0.roach1.LL(:,chan_start:chan_stop));
0204 B1_LL = max(d.antenna0.roach1.LL(:,chan_start:chan_stop));
0205 C1_LL = find(A1_LL>ymax_LL_1 & B1_LL>ymax_LL_1);
0206 D1_LL = find(A1_LL<ymin_LL_1 & B1_LL<ymin_LL_1);
0207 Z = [C1_LL,D1_LL]
0208 off_chan = ['off-scaled channels:' ,num2str(Z)];
0209 plot(Plotdate,d.antenna0.roach1.LL(:,chan_start:chan_stop))
0210 ylim([ymin_LL_1 ymax_LL_1])
0211 hold on;
0212 h1=plot(Plotdate,ll_r1,'-k','LineWidth',2);
0213 title({'ROACH1 LL',off_chan})
0214 legend(h1,'LLAverage')
0215 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0216 hold off;
0217
0218 subplot(nrows,ncols,6)
0219 med = median(d.antenna0.roach2.LL(:,chan_start:chan_stop),2);
0220 st = std(d.antenna0.roach2.LL(:,chan_start:chan_stop),0,2);
0221 scale_factor = 6;
0222 ymin_LL_2 = mean(med)-(mean(st)*scale_factor);
0223 ymax_LL_2 = mean(med)+(mean(st)*scale_factor);
0224 A2_LL = min(d.antenna0.roach2.LL(:,chan_start:chan_stop));
0225 B2_LL = max(d.antenna0.roach2.LL(:,chan_start:chan_stop));
0226 C2_LL = find(A2_LL>ymax_LL_2 & B2_LL>ymax_LL_2);
0227 D2_LL = find(A2_LL<ymin_LL_2 & B2_LL<ymin_LL_2);
0228 Z = [C2_LL,D2_LL]
0229 off_chan = ['off-scaled channels:',num2str(Z)];
0230 plot(Plotdate,d.antenna0.roach2.LL(:,chan_start:chan_stop))
0231 ylim([ymin_LL_2 ymax_LL_2])
0232 hold on;
0233 h1=plot(Plotdate,ll_r2,'-k','LineWidth',2);
0234 title({'ROACH2 LL',off_chan})
0235 legend(h1,'LLAverage')
0236 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0237 hold off;
0238
0239 subplot(nrows,ncols,7)
0240 med = median(d.antenna0.roach1.RR(:,chan_start:chan_stop),2);
0241 st = std(d.antenna0.roach1.RR(:,chan_start:chan_stop),0,2);
0242 scale_factor = 6;
0243 ymin_RR_1 = mean(med)-(mean(st)*scale_factor);
0244 ymax_RR_1 = mean(med)+(mean(st)*scale_factor);
0245 A1_RR = min(d.antenna0.roach1.RR(:,chan_start:chan_stop));
0246 B1_RR = max(d.antenna0.roach1.RR(:,chan_start:chan_stop));
0247 C1_RR = find(A1_RR>ymax_RR_1 & B1_RR>ymax_RR_1);
0248 D1_RR = find(A1_RR<ymin_RR_1 & B1_RR<ymin_RR_1);
0249 Z = [C1_RR,D1_RR]
0250 off_chan = ['off-scaled channels:',num2str(Z)];
0251 plot(Plotdate,d.antenna0.roach1.RR(:,chan_start:chan_stop))
0252 ylim([ymin_RR_1 ymax_RR_1])
0253 hold on;
0254 h1=plot(Plotdate,rr_r1,'-k','LineWidth',2);
0255 title ({'ROACH1 RR',off_chan})
0256 legend(h1,'RRAverage')
0257 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0258 hold off;
0259
0260 subplot(nrows,ncols,8)
0261 med = median(d.antenna0.roach2.RR(:,chan_start:chan_stop),2);
0262 st = std(d.antenna0.roach2.RR(:,chan_start:chan_stop),0,2);
0263 scale_factor = 6;
0264 ymin_RR_2 = mean(med)-(mean(st)*scale_factor);
0265 ymax_RR_2 = mean(med)+(mean(st)*scale_factor);
0266 A2_RR = min(d.antenna0.roach2.RR(:,chan_start:chan_stop));
0267 B2_RR = max(d.antenna0.roach2.RR(:,chan_start:chan_stop));
0268 C2_RR = find(A2_RR>ymax_RR_2 & B2_RR>ymax_RR_2);
0269 D2_RR = find(A2_RR<ymin_RR_2 & B2_RR<ymin_RR_2);
0270 Z = [C2_RR,D2_RR]
0271 off_chan = ['off-scaled channels:',num2str(Z)];
0272 plot(Plotdate,d.antenna0.roach2.RR(:,chan_start:chan_stop))
0273 ylim([ymin_RR_2 ymax_RR_2])
0274 hold on;
0275 h1=plot(Plotdate,rr_r2,'-k','LineWidth',2);
0276 title({'ROACH2 RR',off_chan})
0277 legend(h1,'RRAverage')
0278 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0279 hold off;
0280
0281 subplot(nrows,ncols,9)
0282 med = median(d.antenna0.roach1.Q(:,chan_start:chan_stop),2);
0283 st = std(d.antenna0.roach1.Q(:,chan_start:chan_stop),0,2);
0284 scale_factor = 6;
0285 ymin_Q_1 = mean(med)-(mean(st)*scale_factor);
0286 ymax_Q_1 = mean(med)+(mean(st)*scale_factor);
0287 A1_Q = min(d.antenna0.roach1.Q(:,chan_start:chan_stop));
0288 B1_Q = max(d.antenna0.roach1.Q(:,chan_start:chan_stop));
0289 C1_Q = find(A1_Q>ymax_Q_1 & B1_Q>ymax_Q_1);
0290 D1_Q = find(A1_Q<ymin_Q_1 & B1_Q<ymin_Q_1);
0291 Z = [C1_Q,D1_Q]
0292 off_chan = ['off-scaled channels:',num2str(Z)];
0293 plot(Plotdate,d.antenna0.roach1.Q(:,chan_start:chan_stop))
0294 ylim([ymin_Q_1 ymax_Q_1])
0295 hold on;
0296 h1=plot(Plotdate,q_r1,'-k','LineWidth',2);
0297 title({'ROACH1 Q',off_chan})
0298 legend(h1,'QAverage')
0299 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0300 hold off;
0301
0302 subplot(nrows,ncols,10)
0303 med = median(d.antenna0.roach2.Q(:,chan_start:chan_stop),2);
0304 st = std(d.antenna0.roach2.Q(:,chan_start:chan_stop),0,2);
0305 scale_factor = 6;
0306 ymin_Q_2 = mean(med)-(mean(st)*scale_factor);
0307 ymax_Q_2 = mean(med)+(mean(st)*scale_factor);
0308 A2_Q = min(d.antenna0.roach2.Q(:,chan_start:chan_stop));
0309 B2_Q = max(d.antenna0.roach2.Q(:,chan_start:chan_stop));
0310 C2_Q = find(A2_Q>ymax_Q_2 & B2_Q>ymax_Q_2);
0311 D2_Q = find(A2_Q<ymin_Q_2 & B2_Q<ymin_Q_2);
0312 Z =[C2_Q,D2_Q]
0313 off_chan = ['off-scaled channels:',num2str(Z)];
0314 plot(Plotdate,d.antenna0.roach2.Q(:,chan_start:chan_stop))
0315 ylim([ymin_Q_2 ymax_Q_2])
0316 hold on;
0317 h1=plot(Plotdate,q_r2,'-k','LineWidth',2);
0318 title({'ROACH2 Q',off_chan})
0319 legend(h1,'QAverage')
0320 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0321 hold off;
0322
0323 subplot(nrows,ncols,11)
0324 med = median(d.antenna0.roach1.U(:,chan_start:chan_stop),2);
0325 st = std(d.antenna0.roach1.U(:,chan_start:chan_stop),0,2);
0326 scale_factor = 6;
0327 ymin_U_1 = mean(med)-(mean(st)*scale_factor);
0328 ymax_U_1 = mean(med)+(mean(st)*scale_factor);
0329 A1_U = min(d.antenna0.roach1.U(:,chan_start:chan_stop));
0330 B1_U = max(d.antenna0.roach1.U(:,chan_start:chan_stop));
0331 C1_U = find(A1_U>ymax_U_1 & B1_U>ymax_U_1);
0332 D1_U = find(A1_U<ymin_U_1 & B1_U<ymin_U_1);
0333 Z = [C1_U,D1_U]
0334 off_chan = ['off-scaled channels:',num2str(Z)];
0335 plot(Plotdate,d.antenna0.roach1.U(:,chan_start:chan_stop))
0336 ylim([ymin_U_1 ymax_U_1])
0337 hold on;
0338 h1=plot(Plotdate,u_r1,'-k','LineWidth',2);
0339 title({'ROACH1 U',off_chan})
0340 legend(h1,'UAverage')
0341 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0342 hold off;
0343
0344 subplot(nrows,ncols,12)
0345 med = median(d.antenna0.roach2.U(:,chan_start:chan_stop),2);
0346 st = std(d.antenna0.roach2.U(:,chan_start:chan_stop),0,2);
0347 scale_factor = 6;
0348 ymin_U_2 = mean(med)-(mean(st)*scale_factor);
0349 ymax_U_2 = mean(med)+(mean(st)*scale_factor);
0350 A2_U = min(d.antenna0.roach2.U(:,chan_start:chan_stop));
0351 B2_U = max(d.antenna0.roach2.U(:,chan_start:chan_stop));
0352 C2_U = find(A2_U>ymax_U_2 & B2_U>ymax_U_2);
0353 D2_U = find(A2_U<ymin_U_2 & B2_U<ymin_U_2);
0354 Z = [C2_U,D2_U]
0355 off_chan = ['off-scaled channels:',num2str(Z)];
0356 plot(Plotdate,d.antenna0.roach2.U(:,chan_start:chan_stop))
0357 ylim([ymin_U_2 ymax_U_2])
0358 hold on;
0359 h1=plot(Plotdate,u_r2,'-k','LineWidth',2);
0360 title({'ROACH2 U',off_chan})
0361 legend(h1,'UAverage')
0362 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0363 hold off;
0364
0365 subplot(nrows,ncols,13)
0366 plot(Plotdate,az,'r')
0367 hold on;
0368 plot(Plotdate,el,'b')
0369 legend('Az','El')
0370 title('Azimuth and Elevation')
0371 ylabel('Degree')
0372 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0373 hold off;
0374
0375 subplot(nrows,ncols,14)
0376 plot(PlotdateMed,fast_az_err,'r')
0377 hold on;
0378 plot(PlotdateMed,fast_el_err,'b')
0379 legend('Az Error','El Error')
0380 ylabel('Degree')
0381 title('Az and El Errors')
0382 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0383 hold off;
0384
0385 subplot(nrows,ncols,15)
0386 plot(PlotdateSlow,airTemperature)
0387 ylabel('C')
0388 title('Air Temperature')
0389 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0390
0391 subplot(nrows,ncols,16)
0392 plot(PlotdateSlow,windSpeed)
0393 ylabel('m/s')
0394 title('Wind Speed')
0395 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0396
0397 subplot(nrows,ncols,17)
0398 plot(PlotdateSlow,pressure)
0399 ylabel('mPa')
0400 title('Pressure')
0401 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0402
0403 subplot(nrows,ncols,18)
0404 plot(PlotdateSlow,windDirection)
0405 ylabel('Degree')
0406 title('Wind Direction')
0407 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0408
0409 subplot(nrows,ncols,19)
0410 plot(PlotdateSlow,relativeHumidity)
0411 ylabel('%')
0412 title('Relative Humidity')
0413 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0414
0415 subplot(nrows,ncols,20)
0416 plot(Plotdate_diff,inter1,'r')
0417 ylim([0 0.02])
0418 hold on;
0419 plot(Plotdate_diff,inter2,'b')
0420 ylabel('Timing interval (s)')
0421 legend('ROACH1 timing interval','ROACH2 timing interval')
0422 title ('ROACH1 and ROACH2 timing intervals')
0423 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0424 hold off;
0425
0426 subplot(nrows,ncols,21)
0427 plot(Plotdate,time_array1-time_array2);
0428 ylim([-0.1 0.1])
0429 ylabel('Difference (s)')
0430 title ('Timing difference between ROACH1 and ROACH2')
0431 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0432
0433 subplot(nrows,ncols,22)
0434 plot(Plotdate,time_array1-time_array3,'r')
0435 ylim([-0.1 0.1])
0436 hold on;
0437 plot(Plotdate,time_array2-time_array3,'b')
0438 legend('ROACH1 minus servo','ROACH2 minus servo')
0439 ylabel('Difference (s)')
0440 title ('Timing differences between ROACHes and servo')
0441 datetick('x','yyyy-mm-dd HH:MM:SS','keeplimits')
0442 hold off;
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467 saveas(hFig,[save_path,'_raw.png'],'png')
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
0487