Home > example_scripts > combinecbass.m

combinecbass

PURPOSE ^

this script can be used to read in Healpixed data (usually produced by cbass_write_image) and manipulate it if you

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

this script can be used to read in Healpixed data (usually produced by cbass_write_image) and manipulate it if you
want to-

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %this script can be used to read in Healpixed data (usually produced by cbass_write_image) and manipulate it if you
0002 %want to-
0003 
0004 clear
0005 sum=[];
0006 f=[];
0007 g=[];
0008 
0009 h = gov.fnal.eag.healpix.PixTools;
0010 npix= h.Nside2Npix(nside);
0011 
0012 
0013 % file{1}='atest80-512.fits'
0014 % file{2}='atest81-512.fits'
0015 % file{3}='atest84-512.fits'
0016 % file{4}='atest86-512.fits'
0017 % file{5}='atest87-512.fits'
0018 % file{6}='atest88-512.fits'
0019 % file{7}='atest89-512.fits'
0020 % file{8}='atest90-512.fits'
0021 % file{9}='atest91-512.fits'
0022 % file{10}='atest92-512.fits'
0023 % file{11}='atest93-512.fits'
0024 % file{12}='atest95-512.fits'
0025 % file{13}='atest97-512.fits'
0026 % file{14}='atest98-512.fits'
0027 % file{15}='atest99-512.fits'
0028 
0029 
0030 % numscans=24;
0031 % nside = 256
0032 % file{1}='atest80-256.fits'
0033 % file{2}='atest81-256.fits'
0034 % file{3}='atest84-256.fits'
0035 % file{4}='atest86-256.fits'
0036 % file{5}='atest87-256.fits'
0037 % file{6}='atest88-256.fits'
0038 % file{7}='atest89-256.fits'
0039 % file{8}='atest90-256.fits'
0040 % file{9}='atest91-256.fits'
0041 % file{10}='atest92-256.fits'
0042 % file{11}='atest93-256.fits'
0043 % file{12}='atest95-256.fits'
0044 % file{13}='atest97-256.fits'
0045 % file{14}='atest98-256.fits'
0046 % file{15}='atest99-256.fits'
0047 % file{16}='atest101-256.fits'
0048 % file{17}='atest102-256.fits'
0049 % file{18}='atest103-256.fits'
0050 % file{19}='atest104-256.fits'
0051 % file{20}='atest105-256.fits'
0052 % file{21}='atest106-256.fits'
0053 % file{22}='atest107-256.fits'
0054 % file{23}='atest108-256.fits'
0055 % file{24}='atest109-256.fits'
0056 % file{25}='atest110-256.fits'
0057 % file{26}='atest111-256.fits'
0058 % file{27}='atest112-256.fits'
0059 % file{28}='atest113-256.fits'
0060 % file{29}='atest114-256.fits'
0061 
0062 %%%Can change these parameters to suit the files
0063 numscans=32; %number of scans
0064 nside = 128; %nside Healpix parameter
0065 file{1}='atest80-128.fits'
0066 file{2}='atest81-128.fits'
0067 file{3}='atest84-128.fits'
0068 file{4}='atest86-128.fits'
0069 file{5}='atest87-128.fits'
0070 file{6}='atest88-128.fits'
0071 file{7}='atest89-128.fits'
0072 file{8}='atest90-128.fits'
0073 file{9}='atest91-128.fits'
0074 file{10}='atest92-128.fits'
0075 file{11}='atest93-128.fits'
0076 file{12}='atest97-128.fits'
0077 file{13}='atest98-128.fits'
0078 file{14}='atest99-128.fits'
0079 file{15}='atest99-128.fits'
0080 file{16}='atest101-128.fits'
0081 file{17}='atest102-128.fits'
0082 file{18}='atest103-128.fits'
0083 file{19}='atest104-128.fits'
0084 file{20}='atest105-128.fits'
0085 file{21}='atest106-128.fits'
0086 file{22}='atest107-128.fits'
0087 file{23}='atest108-128.fits'
0088 file{24}='atest110-128.fits'
0089 file{25}='atest111-128.fits'
0090 file{26}='atest112-128.fits'
0091 file{27}='atest112-128.fits'
0092 file{28}='atest113-128.fits'
0093 file{29}='atest114-128.fits'
0094 file{30}='atest118-128.fits'
0095 file{31}='atest119-128.fits'
0096 file{32}='atest120-128.fits'
0097 
0098 
0099 unix(['rm combine-',num2str(nside),'.fits']);
0100 
0101 
0102 
0103 sum=zeros(npix,7);
0104 
0105 for k=1:numscans
0106     for i=1:11
0107         f(:,i) = cbass_read_bin_col(file{k},2,i); 
0108     end
0109     %zero the additions for certain conditions
0110     indI=find(f(:,1)>=8); %get rid of RFI!
0111     f(indI,6)=0;
0112     indI=find(f(:,6)<=4); %get rid of low sampled pixels
0113     f(indI,6)=0;
0114    % indI=find((f(:,1)./f(:,7))<=50); %Signal to noise ratio
0115    % f(indI,6)=0;
0116     for i=1:5
0117         g(:,i) = f(:,i).*f(:,6);
0118     end
0119     g(:,6)=f(:,6);
0120     g(:,7)=f(:,6).*f(:,7); %weighted sigma
0121     indI = find(isnan(g(:,7)));
0122     g(indI,7)=0;
0123     sum=sum+g;
0124 end
0125 %
0126 % for i=1:6
0127 %     f(:,i) = cbass_read_bin_col(file{2},2,i);
0128 % end
0129 %
0130 % for i=1:5
0131 %     g(:,i) = f(:,i).*f(:,6);
0132 % end
0133 % g(:,6)=f(:,6);
0134 % sum = sum+g;
0135 %
0136 % for i=1:6
0137 %     f(:,i) = cbass_read_bin_col(file{3},2,i);
0138 % end
0139 %
0140 % for i=1:5
0141 %     g(:,i) = f(:,i).*f(:,6);
0142 % end
0143 % g(:,6)=f(:,6);
0144 % sum = sum+g;
0145 %
0146 % for i=1:6
0147 %     f(:,i) = cbass_read_bin_col(file{4},2,i);
0148 % end
0149 %
0150 % for i=1:5
0151 %     g(:,i) = f(:,i).*f(:,6);
0152 % end
0153 % g(:,6)=f(:,6);
0154 % sum = sum+g;
0155 
0156 
0157 for i=1:5
0158     meansum(:,i)=sum(:,i)./sum(:,6);
0159 end
0160 meansum(:,6)=sum(:,6);
0161 meansum(:,7) =sum(:,7)./sum(:,6); %total fractional uncertainty/number of measurements->fractional uncertainty
0162 %meansum(:,8) = meansum(:,7).*meansum(:,1); %uncertainty of the pixel using fractional uncertainty*measurement
0163 %indA = find(meansum(:,1)./meansum(:,7))<=0.01); %find the low SNR pixels
0164 indA = find(meansum(:,6)<=50); %find undersampled points
0165 meansum(indA,1:5)=NaN;
0166 meansum(:,1)=meansum(:,1)-5;
0167 
0168 %meansum(:,1)=sum(:,7)./sum(:,6);
0169 %meansum(indA,:)=0; %and then zero them
0170 %meansum(find(isnan(meansum))) = -1;
0171 
0172  cbass_write_image((['combine-',num2str(nside),'.fits']),meansum,nside,npix,'test','test2')
0173

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