Home > reduc > aveHealpix.m

aveHealpix

PURPOSE ^

--------------------------------------------------------------------

SYNOPSIS ^

function dout=aveHealpix(d,nside)

DESCRIPTION ^

--------------------------------------------------------------------
 d=aveHealpix(d,nside)- Should be preceeded by a call to 
 d=pixdat(d,nside);
 [t,A,theta,G]=calculateAlpha(d);
 d=applyAlpha(d,t,A,G)
 [r,A]=rFactorCorrection(d,1)
 d=calculateStokes(d,r)
 d = opacity(d)
 This stores the data to d.antenna0.healpix data and the data is stored as

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dout=aveHealpix(d,nside)
0002 %--------------------------------------------------------------------
0003 % d=aveHealpix(d,nside)- Should be preceeded by a call to
0004 % d=pixdat(d,nside);
0005 % [t,A,theta,G]=calculateAlpha(d);
0006 % d=applyAlpha(d,t,A,G)
0007 % [r,A]=rFactorCorrection(d,1)
0008 % d=calculateStokes(d,r)
0009 % d = opacity(d)
0010 % This stores the data to d.antenna0.healpix data and the data is stored as
0011 %
0012 
0013 h = gov.fnal.eag.healpix.PixTools;
0014 num = h.Nside2Npix(nside);
0015 disp(['aveHealpix:: Number of pixels ',num2str(num)])
0016 onsource=d.index.source.fast & ~d.index.noise.fast & ~d.index.skydip.fast;
0017 skydip = d.index.skydip.fast & ~d.index.source.fast & ~d.index.noise.fast;
0018 noise = d.index.noise.fast & ~d.index.skydip.fast & ~d.index.source.fast;
0019 
0020 %sort the data by pixel number
0021 disp('aveHealpix:: Attempting to use calibrated data')
0022 data=[d.antenna0.receiver.pix(onsource) d.antenna0.receiver.dataTcorr(onsource,:)];
0023 sortdat=sortrows(data,1);
0024 
0025 i=1;
0026 pixn=[];
0027 pixs=[];
0028 %pixs(1)=sortdat(1,1);
0029 ind2=[0];
0030 for i=1:length(sortdat)
0031     pixn = sortdat(i);
0032     pixn1 = sortdat(i+1);
0033     if(pixn1 ~=pixn)
0034         ind2=[ind2 i];
0035         pixs = [pixs sortdat(i,1)];
0036     end
0037 end
0038 pixdata=zeros(length(ind2)-1,19);
0039 for i=1:length(ind2)-1
0040     pixdata(i,1)= pixs(i); %store the pixel numbers that we have present
0041     for j=2:7
0042         pixdata(i,j) = mean(sortdat(ind2(i)+1:ind2(i+1),j)); %store the mean of the first columns
0043     end
0044     for j=8:13
0045         pixdata(i,j) = std(sortdat(ind2(i)+1:ind2(i+1),j-6)); %store the std deviation of the first columns
0046     end
0047     for j=14:19
0048         pixdata(i,j) = length(sortdat(ind2(i)+1:ind2(i+1),j-12)); %store the length
0049     end
0050     
0051     
0052 end
0053 outPixData=zeros(num,19);
0054 for i=1:length(pixdata)
0055     pixel=pixdata(i,1);
0056     outPixData(pixel,:)=pixdata(i,:);
0057 end
0058 
0059 disp('aveHealpix:: Storing to the output data structure in d.antenna0.healpixDat;')
0060 dout=d;
0061 dout.antenna0.healpixDat=outPixData;
0062 
0063 
0064 
0065 
0066 end
0067

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