Home > reduc > analyzeFullSkyAzElMap.m

analyzeFullSkyAzElMap

PURPOSE ^

analyzeFullSkyAzElMap(start,finish,dirname,plotflag)

SYNOPSIS ^

function analyzeFullSkyAzElMap(start,finish,dirname,plotflag)

DESCRIPTION ^

 analyzeFullSkyAzElMap(start,finish,dirname,plotflag)

 This function analyzes the full-sky az/el maps and plots the data:
 e.g. if the observer log contains:
 18-Jun-2011:03:11:42      18-Jun-2011:15:10:16 /home/cbass/gcpCbass/control/sch/full_sky_scan_el_0.5dstep.sch
 you should call:
 analyzeFullSkyAzElMap('18-Jun-2011:03:11:42','18-Jun-2011:15:10:16','/path/to/write/maps')

 ogk 18 June 2011

 Modified by ogk on 6 April 2012 to use the new alpha routines.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function analyzeFullSkyAzElMap(start,finish,dirname,plotflag)
0002 % analyzeFullSkyAzElMap(start,finish,dirname,plotflag)
0003 %
0004 % This function analyzes the full-sky az/el maps and plots the data:
0005 % e.g. if the observer log contains:
0006 % 18-Jun-2011:03:11:42      18-Jun-2011:15:10:16 /home/cbass/gcpCbass/control/sch/full_sky_scan_el_0.5dstep.sch
0007 % you should call:
0008 % analyzeFullSkyAzElMap('18-Jun-2011:03:11:42','18-Jun-2011:15:10:16','/path/to/write/maps')
0009 %
0010 % ogk 18 June 2011
0011 %
0012 % Modified by ogk on 6 April 2012 to use the new alpha routines.
0013 %
0014 
0015 d = read_arc(start, finish, [],[],[],1);
0016 d = pipe_read([],[],d);
0017 s = 'FILTERED';
0018 d = assembleAlphaStreams(d,s);
0019 d = applyAlpha(d,s);
0020 d = calculateStokes(d,s);
0021 
0022 I = d.index.source.fast;
0023 
0024 az = d.antenna0.servo.apparent(I,1);
0025 el = d.antenna0.servo.apparent(I,2);
0026 % ra = d.antenna0.servo.equa(I,1)*180/pi;
0027 % dc = d.antenna0.servo.equa(I,2)*180/pi;
0028 data = d.antenna0.receiver.data(I,:);
0029 
0030 [year,month,day] = mjd2date(tstr2mjd(start));
0031 if ~strcmp(dirname(end),'/')
0032     dirname = [dirname '/'];
0033 end
0034 
0035 fprefix = sprintf('AllSkyMap-%d-%d-%d-',year,month,day);
0036 
0037 % Now naievely bin the data:
0038 dEl = 0.75;
0039 dAz = 0.75;
0040 azC = 0:dAz:(360-dAz);
0041 elC = 15:dEl:85;
0042 Cmap = zeros(length(elC),length(azC),4);
0043 Nmap = zeros(length(elC),length(azC),1);
0044 
0045 % Now do this for each and every sample:
0046 Nsamples = size(az,1);
0047 disp('analyzeFullSkyAzElMap:: Starting map making...')
0048 for k=1:Nsamples
0049     if mod(k,Nsamples/100)==0
0050         fprintf('%3.0f%% done with binning\n',k/Nsamples*100)
0051     end
0052     % What bin does this sample belong to?
0053     Iaz = abs(azC-az(k))<dAz/2;
0054     Iel = abs(elC-el(k))<dEl/2;
0055     Cmap(Iel,Iaz,1) = Cmap(Iel,Iaz,1)+data(k,1);
0056     Cmap(Iel,Iaz,2) = Cmap(Iel,Iaz,2)+data(k,6);
0057     Cmap(Iel,Iaz,3) = Cmap(Iel,Iaz,3)+data(k,7);
0058     Cmap(Iel,Iaz,4) = Cmap(Iel,Iaz,4)+data(k,8);
0059 
0060     Nmap(Iel,Iaz,1) = Nmap(Iel,Iaz,1)+1;
0061 end
0062 disp('analyzeFullSkyAzElMap:: Done map making!')
0063 Cmap = Cmap./repmat(Nmap(:,:,1),[1,1,4]);
0064 
0065 % the limits on the color bars
0066 climI = [-0.05 0.15];
0067 climP = [-0.05 0.05];
0068 climV = [-0.05 0.05];
0069 
0070 CI1 = Cmap(:,:,1);
0071 CI2 = Cmap(:,:,4);
0072 CV = (CI1-CI2)/2;
0073 CQ = Cmap(:,:,2);
0074 CU = Cmap(:,:,3);
0075 CP = sqrt(CQ.^2+CU.^2);
0076 CI = (CI1+CI2)/2;
0077 
0078 save([dirname fprefix 'data.mat'],'fprefix','CI1','CI2','CV','CQ','CU','CP','CI','azC','elC','climI','climP','climV')
0079 
0080 if plotflag
0081     figure('Position',[1 1000 360*3 90*3])
0082     imagesc(azC(:),elC(:),(CI1-repmat(nanmedian(CI1,2),1,size(CI1,2))),climI)
0083     set(gca,'YDir','normal')
0084     colorbar
0085     xlabel('Azimuth')
0086     ylabel('Elevation')
0087     title('I1')
0088     set(gcf,'PaperPositionMode','auto')
0089     eval(sprintf('print -depsc2 -r200 %s',[dirname fprefix 'I1.eps']))
0090 
0091     figure('Position',[1 1000 360*3 90*3])
0092     imagesc(azC(:),elC(:),(CI2-repmat(nanmedian(CI2,2),1,size(CI2,2))),climI)
0093     set(gca,'YDir','normal')
0094     colorbar
0095     xlabel('Azimuth')
0096     ylabel('Elevation')
0097     title('I2')
0098     set(gcf,'PaperPositionMode','auto')
0099     eval(sprintf('print -depsc2 -r200 %s',[dirname fprefix 'I2.eps']))
0100 
0101     figure('Position',[1 1000 360*3 90*3])
0102     imagesc(azC(:),elC(:),(CI-repmat(nanmedian(CI,2),1,size(CI,2))),climI)
0103     set(gca,'YDir','normal')
0104     colorbar
0105     xlabel('Azimuth')
0106     ylabel('Elevation')
0107     title('I=(I1+I2)/2')
0108     set(gcf,'PaperPositionMode','auto')
0109     eval(sprintf('print -depsc2 -r200 %s',[dirname fprefix 'I.eps']))
0110 
0111     figure('Position',[1 1000 360*3 90*3])
0112     imagesc(azC(:),elC(:),(CV-repmat(nanmedian(CV,2),1,size(CV,2))),climV)
0113     set(gca,'YDir','normal')
0114     colorbar
0115     xlabel('Azimuth')
0116     ylabel('Elevation')
0117     title('V=(I1-I2/2)')
0118     set(gcf,'PaperPositionMode','auto')
0119     eval(sprintf('print -depsc2 -r200 %s',[dirname fprefix 'V.eps']))
0120 
0121     figure('Position',[1 1000 360*3 90*3])
0122     imagesc(azC(:),elC(:),(CQ-repmat(nanmedian(CQ,2),1,size(CQ,2))),climP)
0123     set(gca,'YDir','normal')
0124     colorbar
0125     xlabel('Azimuth')
0126     ylabel('Elevation')
0127     title('Q')
0128     set(gcf,'PaperPositionMode','auto')
0129     eval(sprintf('print -depsc2 -r200 %s',[dirname fprefix 'Q.eps']))
0130 
0131     figure('Position',[1 1000 360*3 90*3])
0132     imagesc(azC(:),elC(:),(CU-repmat(nanmedian(CU,2),1,size(CU,2))),climP)
0133     set(gca,'YDir','normal')
0134     colorbar
0135     xlabel('Azimuth')
0136     ylabel('Elevation')
0137     title('U')
0138     set(gcf,'PaperPositionMode','auto')
0139     eval(sprintf('print -depsc2 -r200 %s',[dirname fprefix 'U.eps']))
0140 
0141     figure('Position',[1 1000 360*3 90*3])
0142     imagesc(azC(:),elC(:),(CP-repmat(nanmedian(CP,2),1,size(CP,2))),[0 max(climP)])
0143     set(gca,'YDir','normal')
0144     colorbar
0145     xlabel('Azimuth')
0146     ylabel('Elevation')
0147     title('P = sqrt(Q^2+U^2)')
0148     set(gcf,'PaperPositionMode','auto')
0149     eval(sprintf('print -depsc2 -r200 %s',[dirname fprefix 'P.eps']))
0150 end
0151 end

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