Home > cbassSouthFunctions > CJCThesisFunctions > hartrao > noiseAddingRadiometer.m

noiseAddingRadiometer

PURPOSE ^

read the switched data

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

read the switched data

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %read the switched data
0002 d=read_arcSouth('22-Apr-2013:19:54:59','22-Apr-2013:20:55:01')
0003 
0004 
0005 
0006 nd=d.antenna0.roach1.switchstatus;
0007 
0008 
0009 Il= mean(d.antenna0.roach1.LL(:,10:50),2);
0010 Ir= mean(d.antenna0.roach1.RR(:,10:50),2);
0011 IlLoad= mean(d.antenna0.roach1.load2(:,10:50),2);
0012 IrLoad= mean(d.antenna0.roach1.load1(:,10:50),2);
0013 
0014 dnd=diff(nd);
0015 dndindexpos=find(dnd==1);
0016 nd(dndindexpos)=5;
0017 nd(dndindexpos+1)=5;
0018 nd(dndindexpos-1)=5;
0019 nd(dndindexpos+2)=5;
0020 nd(dndindexpos-2)=5;
0021 Il(dndindexpos)=0;
0022 Il(dndindexpos+1)=0;
0023 Il(dndindexpos-1)=0;
0024 Il(dndindexpos+2)=0;
0025 Il(dndindexpos-2)=0;
0026 
0027 dndindexneg=find(dnd==-1);
0028 nd(dndindexneg)=5;
0029 nd(dndindexneg+1)=5;
0030 nd(dndindexneg-1)=5;
0031 nd(dndindexneg+2)=5;
0032 nd(dndindexneg-2)=5;
0033 Il(dndindexneg)=0;
0034 Il(dndindexneg+1)=0;
0035 Il(dndindexneg-1)=0;
0036 Il(dndindexneg+2)=0;
0037 Il(dndindexneg-2)=0;
0038 
0039 
0040 ndon=find(nd==1);
0041 ndoff=find(nd==0);
0042 nddiff=diff(nd);
0043 subplot(211),plot(dnd(1:100000))
0044 subplot(212),plot(ndon(1:100000),Il(ndon(1:100000)),'.')
0045 hold all
0046 plot(ndoff(1:100000),Il(ndoff(1:100000)),'.')
0047 
0048 
0049 
0050 %find the points where the ndon index values aren't one (i.e the points
0051 %where the noise diode actually turns on will be much bigger than one
0052 a=find(nd==1); % find index values where the noise diode is on
0053 b=find(diff(a)>50); % find the points where the index increases by more than 90
0054 c=a(b); % get index values where noise diode turns off
0055 d=a(b+1); % get the index values where noise diode turns on
0056 
0057 ndonEdges=[];
0058 for i=1:length(c)
0059     ndonEdges=[ndonEdges c(i) d(i)];
0060 end
0061 
0062 
0063 %find the points where the ndon index values aren't one (i.e the points
0064 %where the noise diode actually turns on will be much bigger than one
0065 a=find(nd==0); % find index values where the noise diode is off
0066 b=find(diff(a)>50); % find the points where the index increases by more than 90
0067 c=a(b); % get index values where noise diode turns on
0068 d=a(b+1); % get the index values where noise diode turns off
0069 
0070 ndoffEdges=[];
0071 for i=1:length(c)
0072     ndoffEdges=[ndoffEdges c(i) d(i)];
0073 end
0074 
0075 %%%-----------------
0076 %create indexing to extract the off and on states
0077 indexOn=[];
0078 indexOff=[];
0079 timeValOn=[];
0080 timeValOff=[];
0081 for i=1:length(ndonEdges)./2-1
0082     indexOn{i}=[ndonEdges(2*i):ndonEdges(2*i+1)];
0083     timeValOn(i)=mean(indexOn{i});
0084     i
0085 end
0086 for i=1:(length(ndoffEdges)./2-1)
0087      indexOff{i}=[ndoffEdges(2*i):ndoffEdges(2*i+1)];
0088      timeValOff(i)=mean(indexOff{i});
0089 end
0090    
0091 %now we calculate the mean value for each noise diode period
0092 meanOn=[];
0093 meanOff=[];
0094 stdOn=[];
0095 stdOff=[];
0096 
0097 for i=1:length(indexOn)
0098     meanOn(i)=mean(Il(indexOn{i}));
0099     stdOn(i)=std(Il(indexOn{i}));
0100 end
0101 
0102 for i=1:length(indexOff)
0103     meanOff(i)=mean(Il(indexOff{i}));
0104     stdOff(i)=std(Il(indexOff{i}));
0105 end
0106 
0107 
0108 Ilndon=Il(ndon);
0109 Ilndoff=Il(ndoff);
0110 
0111 plot(Ilndon)
0112 hold all
0113 plot(Ilndoff)
0114 
0115 
0116 % Now we use the following relationship
0117 %1)Ton = G(Tsky + Trx + Tnd)
0118 %2)Toff = G(Tsky+Trx)
0119 %3)Ton-Toff = G.Tnd
0120 %So 1)/3) = (Tsky+Trx+Tnd)
0121 % and 2)/3) = Tsky+Trx
0122 %So Ton-Toff will track the Gain
0123 #
0124 GNd = meanOn-meanOff;
0125 plot(deltaNd)
0126 gndts=timeseries(GNd(1:length(GNd)-1),timeValOn(1:length(GNd)-1));
0127 time=[1:length(Il)];
0128 Ilts=timeseries(Il,time);
0129 
0130 gndtsResampled= resample(gndts, time) 
0131 
0132 gndres=gndtsResampled.Data(1,:);
0133 
0134 
0135 %now we calculate the mean value for each noise diode period
0136 Ilon=[];
0137 Iloff=[];
0138 for i=1:length(indexOn)
0139     Ilon(indexOn{i})=(Il(indexOn{i}))./GNd(i);
0140 end
0141 
0142 for i=1:length(indexOff)
0143     meanOff(i)=mean(Il(indexOff{i}));
0144 end
0145 
0146 
0147 subplot(211)
0148 
0149 
0150 
0151 plot(ndon./t)
0152 hold all
0153 plot(ndoff./t)
0154 
0155 
0156 
0157 
0158 
0159 
0160 
0161 
0162 
0163 
0164 
0165 plot(Il(indexOn{1}))
0166 hold all
0167 for i=2:1500
0168     plot(Il(indexOn{i}))
0169 end
0170 
0171 
0172 plot(Il(indexOff{1}))
0173 
0174 for i=2:1500
0175     plot(Il(indexOff{i}))
0176 end
0177 
0178 
0179 plot(indexCuts,'.')
0180 
0181 plot(Il)
0182

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005