0001 function flags = flagRfactor(d, r_f, flagParams)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 keyboard;
0018
0019
0020 if(any(abs(r_f)>flagParams(1)))
0021 flags = ones(size(d.antenna0.receiver.dataT));
0022 return;
0023 end
0024
0025
0026
0027
0028
0029
0030 [dcut indFast] = cutObs(d, 'source', 'only');
0031
0032
0033
0034
0035 for m=1:6
0036 noCorr(:,m) = ...
0037 0.5*sum(dcut.antenna0.receiver.switchDataT(:,[(m-1)*4+2 ...
0038 (m-1)*4+3]) - ...
0039 dcut.antenna0.receiver.switchDataT(:,[(m-1)*4+1 (m)*4]), 2);
0040 end
0041 withCorr = dcut.antenna0.receiver.dataT;
0042
0043
0044 timeVal = (dcut.antenna0.receiver.utc - dcut.antenna0.receiver.utc(1))*24*60;
0045 f = find(diff(timeVal)>0.02);
0046 for m=1:length(f)
0047 if(m==1)
0048 si(m) = 1;
0049 else
0050 si(m) = f(m-1)+1;
0051 end
0052
0053 if(m==length(f))
0054 ei(m) = length(timeVal);
0055 else
0056 ei(m) = f(m);
0057 end
0058 end
0059
0060
0061
0062
0063 slopeNoCorr = zeros(length(ei), 6);
0064 slopeCorr = zeros(length(ei), 6);
0065
0066 for m=1:length(ei)
0067 thisX = timeVal(si(m):ei(m));
0068 thisX = thisX - thisX(1);
0069
0070 thisYno = noCorr(si(m):ei(m),:);
0071 thisYyes= withCorr(si(m):ei(m),:);
0072
0073 f = find(dcut.flags.fast(si(m):ei(m),:));
0074 thisYno(f) = nan;
0075 thisYyes(f) = nan;
0076
0077
0078 [slopeNoCorr(m,:) ynocorr(m,:)] = linfit(thisX, thisYno);
0079 [slopeCorr(m,:) ycorr(m,:)] = linfit(thisX, thisYyes);
0080
0081 end
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091