Apply multiple steps of the pipeline to the data, and record the number of successful stages. If any stage fails then just return what does succeed. This function probably replicates stuff that other functions do. Right now it calls: calculateAlpha,applyAlpha2, calculateRfactor, calculateStokes2, opacity.
0001 0002 function [d stages] = pipelinedData(d) 0003 %Apply multiple steps of the pipeline to the data, and record the 0004 %number of successful stages. If any stage fails then just return what 0005 %does succeed. 0006 % 0007 % This function probably replicates stuff that other functions do. 0008 % Right now it calls: calculateAlpha,applyAlpha2, 0009 % calculateRfactor, calculateStokes2, opacity. 0010 % 0011 0012 0013 %function used for recording cbass data for Descartes map making 0014 0015 %h = gov.fnal.eag.healpix.PixTools; 0016 0017 %npix= h.Nside2Npix(nside); 0018 stages=0; 0019 0020 0021 try 0022 [t,A,G,T,horiz,equa,offStartPos,onEndPos,offEndPos,onStartPos]=calculateAlpha(d); 0023 catch 0024 disp_err('Failed calculateAlpha'); 0025 return; 0026 end 0027 stages=stages+1; 0028 0029 0030 try 0031 d=applyAlpha2(d,t,A,G); 0032 catch 0033 disp_err('Failed the applyAlpha') 0034 return; 0035 end 0036 stages=stages+1; 0037 0038 0039 try 0040 thisAlpha = [t A G T horiz equa]; 0041 d.correction.alpha.indices = [offStartPos' onEndPos' offEndPos' onStartPos']; 0042 d.correction.alpha.values = thisAlpha; 0043 %[r,A]=rFactorCorrection(d,1) 0044 r=calculateRfactor(d); 0045 catch 0046 disp_err('Failed the rFactorCorrection') 0047 return; 0048 end 0049 stages=stages+1; 0050 0051 0052 try 0053 d=calculateStokes2(d,r,1); 0054 catch 0055 disp_err('Failed the calculateStokes'); 0056 return; 0057 end 0058 stages=stages+1; 0059 0060 0061 try 0062 d = opacity(d); 0063 catch 0064 disp_err('Failed opacity') 0065 return; 0066 end 0067 stages=stages+1; 0068 % disp('Pixellating the data') 0069 % d=pixdat(d,nside); 0070 % d=aveHealpix(d,nside); 0071 0072 0073 % I = d.antenna0.healpixDat(:,2); 0074 % Q1 = d.antenna0.healpixDat(:,3); 0075 % Q2 = d.antenna0.healpixDat(:,5); 0076 % U1 = d.antenna0.healpixDat(:,4); 0077 % U2 = d.antenna0.healpixDat(:,6); 0078 % N_OBS = d.antenna0.healpixDat(:,14); 0079 % sig_I = d.antenna0.healpixDat(:,8); 0080 % sig_Q1 = d.antenna0.healpixDat(:,9); 0081 % sig_Q2 = d.antenna0.healpixDat(:,11); 0082 % sig_U1 = d.antenna0.healpixDat(:,10); 0083 % sig_U2 = d.antenna0.healpixDat(:,12); 0084 % d.antenna0.writeHealpixDat= [I Q1 Q2 U1 U2 N_OBS sig_I sig_Q1 sig_Q1 sig_U1 sig_U2]; 0085 %unix('rm filename.fits'); 0086 %cbass_write_image('filename.fits',[I Q1 Q2 U1 U2 N_OBS],nside,npix,'start','stop'); 0087 return; 0088 end 0089 0090 function [d stages] = pipelindData(d) 0091 %This is a mis-spelled version of pipelinedData, added to ensure that 0092 %people trying to use the old mis-spelling still succeed. 0093 0094 [d stages]=pipelinedData(d); 0095 end 0096 0097 0098 function disp_err(s) 0099 stderr=2; 0100 fprintf(stderr,'%s\n',s); 0101 return; 0102 end