0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 filename = '/elephant/act/CBASS/cbass_analysis/cbass_s_matlab_scripts/Load_Sky_Balance/be_tsys_23apr.txt';
0017 delimiter = ' ';
0018
0019
0020
0021
0022
0023
0024
0025
0026 formatSpec = '%f%f%f%f%f%[^\n\r]';
0027
0028
0029 fileID = fopen(filename,'r');
0030
0031
0032
0033
0034
0035 dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'MultipleDelimsAsOne', true, 'ReturnOnError', false);
0036
0037
0038 fclose(fileID);
0039
0040
0041
0042
0043
0044
0045
0046
0047 Frequency = dataArray{:, 1};
0048 Tsys(1,:) = dataArray{:, 2};
0049 Tsys(2,:) = dataArray{:, 3};
0050 Tsys(3,:) = dataArray{:, 4};
0051 Tsys(4,:) = dataArray{:, 5};
0052
0053
0054 clearvars filename delimiter formatSpec fileID dataArray ans;
0055
0056
0057 d = read_arcSouth('30-Apr-2013:03:16:52 ',' 30-Apr-2013:03:36:44')
0058
0059
0060 LL = [d.antenna0.roach1.LL,d.antenna0.roach2.LL];
0061
0062 LL_load = [d.antenna0.roach1.load2,d.antenna0.roach2.load2];
0063
0064 for freq_chan = 1:128
0065 best = (abs(LL(:,freq_chan)-LL_load(:,freq_chan))<3000);
0066 balance_LL(2,freq_chan) = nanmean(d.antenna0.thermal.ccTemperatureLoadFast(best));
0067 balance_LL(1,freq_chan)= freq_chan;
0068 end
0069
0070
0071 nans=isnan(balance_LL(2,:));
0072 balance_LL(2,nans)=0;
0073 plot(balance_LL(1,:),balance_LL(2,:),'.')
0074
0075
0076
0077 weights = 1./(Tsys(1,:)).^2;
0078
0079
0080 sum_of_weights_r1 = sum(weights(1:64));
0081 sum_of_weights_r2 = sum(weights(65:128));
0082
0083
0084
0085
0086 for freq_chan= 1:64
0087 weighted_LL_r1(:,freq_chan) = (weights(freq_chan).*LL(:,freq_chan));
0088
0089 end
0090 for freq_chan= 65:128
0091 weighted_LL_r2(:,freq_chan) = (weights(freq_chan).*LL(:,freq_chan));
0092
0093 end
0094 LL_weighted_freq_r1 = sum(weighted_LL_r1,2)./sum_of_weights_r1;
0095 LL_freq_r1= mean(LL,2);
0096 LL_weighted_freq_r2 = sum(weighted_LL_r2,2)./sum_of_weights_r2;
0097 LL_r1= LL(:,1:64);
0098 LL_r2 = LL(:,65:128);
0099 LL_r1_freq= mean(LL_r1,2);
0100 LL_r2_freq= mean(LL_r2,2);
0101
0102 LL_load_r1 = LL_load(:,1:64);
0103 LL_load_r2 = LL_load(:,65:128);
0104 LL_load_r1_freq = mean(LL_load_r1,2);
0105 LL_load_r2_freq = mean(LL_load_r2,2);
0106
0107
0108 figure(1)
0109 plot(LL_r1_freq)
0110 hold all
0111 plot(LL_load_r1_freq)
0112 plot(LL_weighted_freq_r1)
0113 title('LL Roach 1')
0114
0115
0116
0117 figure(2)
0118 plot(LL_r2_freq)
0119 hold all
0120 plot(LL_load_r2_freq)
0121 plot(LL_weighted_freq_r2)
0122 title('LL Roach 2')
0123
0124 figure(1)
0125 plot(LL_r1_freq)
0126 hold all
0127 plot(LL_load_r1_freq)
0128 plot(LL_weighted_freq_r1)
0129 title('LL Roach 1')
0130
0131
0132 figure(1)
0133 plot(LL_r1_freq)
0134 hold all
0135 plot(LL_load_r1_freq)
0136 plot(LL_weighted_freq_r1)
0137 title('LL Roach 1')
0138
0139
0140 figure(3)
0141 plot(balance_LL(2,1:64),Tsys(1,1:64),'.')
0142 title('Balance vs Tsys, Roach 1')
0143 xlabel('Balance point, K')
0144 ylabel('Tsys, K')
0145 ylim([0 100])
0146 grid on
0147
0148 figure(4)
0149 plot(balance_LL(2,65:128),Tsys(1,65:128),'.')
0150 title('Balance vs Tsys, Roach 2')
0151 xlabel('Balance point, K')
0152 ylabel('Tsys, K')
0153 grid on
0154 ylim([0 100])
0155
0156 figure(5)
0157 plot(balance_LL(2,1:64),weights(1,1:64),'.')
0158 title('Balance vs Weighting, Roach 1')
0159 xlabel('Balance point, K')
0160 ylabel('weighting')
0161 grid on
0162
0163