Home > rfi_tuning > stat_hist.m

stat_hist

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function [s_A s_B l_A l_B] = stat_hist(foldResult, shortI_A, shortI_B, shortL_A, shortL_B, longI_B, longI_B_min, longI_B_max, longL_A, longL_B);

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  function r = stat_hist(foldResult, shortI_A, shortI_B, shortL_A, shortL_B, longI_B, longI_B_min, longI_B_max, longL_A, longL_B);

   25-Jan-2012 (MAS): Created.


   Constructs the four histograms used for choosing the 
   statistical flagging parameters.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [s_A s_B l_A l_B] = stat_hist(foldResult, shortI_A, shortI_B, shortL_A, shortL_B, longI_B, longI_B_min, longI_B_max, longL_A, longL_B);
0002 
0003 
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %  function r = stat_hist(foldResult, shortI_A, shortI_B, shortL_A, shortL_B, longI_B, longI_B_min, longI_B_max, longL_A, longL_B);
0006 %
0007 %   25-Jan-2012 (MAS): Created.
0008 %
0009 %
0010 %   Constructs the four histograms used for choosing the
0011 %   statistical flagging parameters.
0012 %
0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0014 
0015 
0016 % Now we make the histograms:
0017 s_A = zeros(2,100,40,150);
0018 s_B = zeros(2,500);
0019 l_A = zeros(2,100,100,100);
0020 l_B = zeros(2,100,200);
0021 
0022 
0023 
0024 % We will go ahead and loop over the sigma values:
0025 for p=1:2
0026 
0027     disp(' Next sigma level...');
0028         
0029     if p == 1
0030         sigma_sel = foldResult == 1;
0031     else
0032         sigma_sel = foldResult == 4;
0033     end
0034 
0035     % Get the desired std deviation statistics...
0036     shortI_A_c = shortI_A(sigma_sel);
0037     shortI_B_c = shortI_B(sigma_sel);
0038     shortL_A_c = shortL_A(sigma_sel);
0039     shortL_B_c = shortL_B(sigma_sel);
0040 
0041     longI_B_c = longI_B(sigma_sel);
0042     longI_B_min_c = longI_B_min(sigma_sel);
0043     longI_B_max_c = longI_B_max(sigma_sel);
0044     longL_A_c = longL_A(sigma_sel);
0045     longL_B_c = longL_B(sigma_sel);
0046 
0047     
0048     
0049     % Do 3D Array s_A:
0050     disp('   Array s_A...');
0051     for l=1:100
0052     p1 = 0.1*l;
0053         sel1 = shortL_A_c > p1;
0054 
0055         shortI_A_1 = shortI_A_c(sel1);
0056         shortI_B_1 = shortI_B_c(sel1);
0057         shortL_A_1 = shortL_A_c(sel1);
0058         shortL_B_1 = shortL_B_c(sel1);
0059         for m=1:40
0060             p2 = 0.1*m;
0061             sel2 = shortL_A_1 > p2*shortI_A_1 & shortL_B_1 > p2*shortI_B_1;
0062 
0063             shortL_A_2 = shortL_A_1(sel2);
0064             shortL_B_2 = shortL_B_1(sel2);
0065             for n=1:150
0066                 p3 = 0.1*n;
0067                 sel3 = shortL_B_2 < p3 * shortL_A_2;
0068 
0069                 s_A(p,l,m,n) = sum(sel3);
0070             end
0071         end
0072     end
0073     
0074     
0075     % Do 1D histogram s_B:
0076     disp('   Histogram sB...');
0077     for l=1:500
0078         p4 = 0.1*l;
0079 
0080      s_B(p,l) = sum(shortL_A_c > p4);
0081     end
0082 
0083 
0084 
0085     % Do 3D histogram l_A:
0086     disp('   Histogram lA...');
0087     for l=1:100
0088         p5 = 0.1*l;
0089         sel1 = longL_A_c > p5;
0090 
0091         longI_B_1 = longI_B_c(sel1);
0092         longL_B_1 = longL_B_c(sel1);
0093         for m=1:100
0094             p6 = 0.1*m;
0095             sel2 = longL_B_1 > p6;
0096 
0097             longI_B_2 = longI_B_1(sel2);
0098             longL_B_2 = longL_B_1(sel2);
0099             for n=1:100
0100                 p7 = 0.1*n;
0101                 sel3 = longL_B_2 > p7 * longI_B_2;
0102 
0103                 l_A(p,l,m,n) = sum(sel3);
0104             end
0105         end
0106     end
0107 
0108         
0109     % Do 2D histogram l_B:
0110     disp('   Histogram lB...');
0111     for l=1:100
0112         p8 = 0.1*l;
0113         sel1 = longI_B_max_c > p8;
0114 
0115         longI_B_min_1 = longI_B_min_c(sel1);
0116         longI_B_max_1 = longI_B_max_c(sel1);
0117         for m=1:200
0118             p9 = 0.1*m;
0119             sel2 = longI_B_max_1 > p9 * longI_B_min_1;
0120 
0121             l_B(p,l,m) = sum(sel2);
0122         end
0123     end
0124     
0125     
0126 end
0127     
0128 
0129 end

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