Home > reduc > support > loadWrapper.m

loadWrapper

PURPOSE ^

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

SYNOPSIS ^

function d = loadWrapper(d, plotparams, parm, field)

DESCRIPTION ^

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

  function d = loadWrapper(d, plotparams, parm, field);

    reduceData function that removes the variation of the cold load

    sjcm

   3/30/2011 sjcm:  saving plots without displaying
   4/04/2012 mas:  updated with new template fitting procedure.
   5/01/2012 mas:  updated to work with latest ASCII template database.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function d = loadWrapper(d, plotparams, parm, field)
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 %  function d = loadWrapper(d, plotparams, parm, field);
0006 %
0007 %    reduceData function that removes the variation of the cold load
0008 %
0009 %    sjcm
0010 %
0011 %   3/30/2011 sjcm:  saving plots without displaying
0012 %   4/04/2012 mas:  updated with new template fitting procedure.
0013 %   5/01/2012 mas:  updated to work with latest ASCII template database.
0014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0015 
0016 [d,q] = logcal(d, 'alpha');
0017 if (~q)
0018   disp('Alpha correction not yet applied.  You need to do that first.');
0019   disp(' ')
0020 %  d=checkstatus(d);
0021   return
0022 end
0023 [d,q] = logcal(d, 'load');
0024 if (q)
0025   disp('Load correction has been applied');
0026   disp(' ')
0027 %  d=checkstatus(d);
0028   return
0029 end
0030 
0031 
0032 
0033 
0034 % Check which type of data we're using.
0035 parFlag = checkpar(parm, 'alpha');
0036 if(parFlag)
0037   alphaType  = parm.alpha.type; % 0/1/2: filtered/classic/polonly
0038 % else
0039 %   display('No alpha correction type specified, defaulting to classic data');
0040 %   alphaType  = 1;
0041 % end
0042 else
0043   % check if we're running interactively so we can set what we want.
0044   if(plotparams.interactive==1)
0045     display('You are running in interactive mode');
0046     alphaType = 4;
0047     while(alphaType<0 || alphaType>3)
0048       alphaType = input('What type of correction do you want?  [0-FILTERED, 1-CLASSIC, 2-POLONLY] ');
0049       if alphaType == 0 && size(d.antenna0.receiver.data,2) ~= 8
0050         display('Wait... your data are not filtered-mode, alpha-corrected.');
0051         alphaType = 4;
0052       elseif alphaType == 1 && size(d.antenna0.receiver.data,2) ~= 10
0053         display('Wait... your data are not classic-mode, alpha-corrected.');
0054         alphaType = 4;
0055       elseif alphaType == 2 && size(d.antenna0.receiver.data,2) ~= 8
0056         display('Wait... your data are not polonly-mode, alpha-corrected.');
0057         alphaType = 4;
0058       end
0059     end
0060   else
0061     display('No correction type specified, defaulting to classic data.');
0062     alphaType  = 1;
0063     if size(d.antenna0.receiver.data,2) ~= 10
0064       display('Wait... your data are not classic-mode, alpha-corrected.');
0065       return;
0066     end
0067   end
0068 end
0069 
0070 
0071 
0072 % Check which type of scaling we'll use.
0073 parFlag = checkpar(parm, 'load');
0074 if(parFlag)
0075   scaleType = [parm.load.scaleType];
0076 else
0077   display('No load scaling chosen.  Default to direct fit.');
0078   scaleType = 0; % 0/1/2: data/switchData/alpha
0079 end
0080 
0081 
0082 
0083 if scaleType ~= 0
0084     % This is on MAS's todo list.  MAS:  Actually, I'm not going to do this.
0085     disp('Alternative load scaling methods will probably not be implemented.  Unless you (yes YOU!) can prove that they would actually work...');
0086     scaleType = 0;
0087 end
0088 
0089 
0090 % Keep this for the plotting stage.
0091 dorig = d;
0092 
0093 % And here is the correction.
0094 d = load_template_corr(d,alphaType,scaleType);
0095 
0096 
0097 % next we plot to see if there was any effect at all
0098 setPlotDisplay(plotparams.plot);
0099 display('Plotting Power Spectrum');
0100 display('No flagging will be allowed');
0101 
0102 d = packd(d, [], 'none', 'load_cal', plotparams, 'Load Plots', field, dorig);
0103 
0104 % log that it has been applied
0105 d = logcal(d, 'load');
0106 
0107 
0108 return;
0109 
0110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0111 function d=checkstatus(d)
0112 
0113 disp('Would you like to view the plots?')
0114 
0115 if (query)
0116   d = packd(d, [], 'none', 'load', 0, 'Load Plots', '');
0117 end
0118 
0119 disp(' ')
0120 
0121

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