Home > reduc > load > createTemplateEstimates.m

createTemplateEstimates

PURPOSE ^

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

SYNOPSIS ^

function [mjdVec recalcVec numArray estimateArray] =createTemplateEstimates(mjdVec, numArray, estimateArray,startMJD,endMJD,newEstimatesDir)

DESCRIPTION ^

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

 function [mjdVec recalcVec numArray estimateArray] = ...
    createTemplateEstimates(mjdVec, numArray, estimateArray,startMJD,endMJD,newEstimatesDir)

   Calculates the new template estimates.


   I/O:

   MAS -- 27-Nov-2012

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [mjdVec recalcVec numArray estimateArray] = ...
0002     createTemplateEstimates(mjdVec, numArray, estimateArray,startMJD,endMJD,newEstimatesDir)
0003 
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % function [mjdVec recalcVec numArray estimateArray] = ...
0007 %    createTemplateEstimates(mjdVec, numArray, estimateArray,startMJD,endMJD,newEstimatesDir)
0008 %
0009 %   Calculates the new template estimates.
0010 %
0011 %
0012 %   I/O:
0013 %
0014 %   MAS -- 27-Nov-2012
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 % Generate the newer 2-hour template estimates.
0019 %mjd0 = floor(startMJD);
0020 %hour0 = round(24*mod(startMJD,1));
0021 
0022 % Need these:
0023 n_phase = size(estimateArray,1);
0024 n_pol = size(estimateArray,3);
0025 
0026 
0027 % Check to see if we're overwriting anything...
0028 recalcVec = mjdVec > (startMJD-0.1/12) & mjdVec < (endMJD+0.1/12);
0029 
0030 
0031 % How many additional templates to calculate?
0032 n_new = max(0,round(12*(endMJD - max(startMJD-1./12,mjdVec(end))))-1);
0033 
0034 
0035 % Initialize the output arrays (if necessary).
0036 if n_new > 0
0037     mjdVec = [mjdVec, max(startMJD-1/12,mjdVec(end))+(1:n_new)/12];
0038     recalcVec = [recalcVec, ones(1, n_new)];
0039     numArray = [numArray, ones(n_phase, n_new)];
0040     estimateArray = [estimateArray ones(n_phase, n_new, n_pol)];
0041 end
0042 
0043 
0044 % Loop over list of templates to be calculated...
0045 for k=find(recalcVec)
0046 
0047     mjdStart = mjdVec(k);
0048     mjdEnd = mjdVec(k) + 1/12;
0049 
0050     utcStart = mjd2string(mjdStart);
0051     utcEnd = mjd2string(mjdEnd);
0052     
0053 
0054     disp(['Calculating template estimates for ' utcStart ' to ' utcEnd]);
0055     [new_num new_templates] = genTemplateEstimates(utcStart,utcEnd,newEstimatesDir,n_phase);
0056     
0057 
0058     numArray(:,k) = new_num;
0059     estimateArray(:,k,:) = new_templates;
0060 end
0061 
0062 
0063 end

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