Home > reduc > support > pointingWrapper.m

pointingWrapper

PURPOSE ^

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

SYNOPSIS ^

function d = pointingWrapper(d, plotparams, parm, field,thedate_day_portion);

DESCRIPTION ^

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

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

    reduceData function that scans for pointing crosses, fits a gaussian to
    it, and then records the data to disk

    sjcm

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function d = pointingWrapper(d, plotparams, parm, field,thedate_day_portion);
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 %  function d = pointingWrapper(d, plotparams, parm, field);
0006 %
0007 %    reduceData function that scans for pointing crosses, fits a gaussian to
0008 %    it, and then records the data to disk
0009 %
0010 %    sjcm
0011 %
0012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0013 
0014 if(nargin==3)
0015   field = [];
0016 end
0017 
0018 % check if we have any pointing crosses.
0019 if(length(find(d.index.radio_point_cross.slow))>10)
0020   hasPoint = 1;
0021   isScan   = 0;
0022 elseif(length(find(d.index.radio_point_scan.slow))>10)
0023   hasPoint = 1;
0024   isScan   = 1;
0025 else
0026   % no crosses to look at
0027   display('NO CROSSES IN THIS DATA SET');
0028   return;
0029   hasPoint = 0;
0030   isScan   = 0;
0031 end
0032 
0033 
0034 pointing_crosses_filename = ['pointing_crosses_',thedate_day_portion,'.txt']
0035 pointing_full_data_filename =['pointing_full_data_',thedate_day_portion,'.txt']
0036 
0037 
0038 display('in pointing');
0039 
0040 % call to radPointPlots
0041 
0042 if(issubfield(parm, 'pointing', 'method'))
0043   method = parm.pointing.method;
0044 else
0045   method = 1;
0046 end
0047 
0048 if(isScan)
0049   [obs off ide out] = radPointPlots(d, plotparams, 'scan', field, [], method);
0050 else
0051   [obs off ide out] = radPointPlots(d, plotparams, 'cross', field);
0052 end
0053 
0054 % next we save the values.
0055 if(~isempty(off.az))
0056   % form is:  [time, sourceName, sourceaz, sourceel, offaz, offel];
0057   for m=1:length(obs.name)
0058     srcNum(m) = sourceCorrespondance(obs.name(m));
0059   end
0060   
0061   thisCross = [obs.timeVal' srcNum' obs.az' obs.el' off.az ...
0062     off.el ide.az' ide.el'];
0063   
0064   d.correction.pointing = thisCross;
0065   
0066   [home,installeddir]=where_am_i();
0067  
0068   if(~isempty(out))
0069     for m=1:length(out.name)
0070       srcOut(m) = sourceCorrespondance(out.name(m));
0071     end
0072     outCross = [out.time' srcOut' out.az' out.el' out.badpt out.xoff out.yoff out.errxoff ...
0073       out.erryoff out.xwidth out.ywidth out.azpeak out.azmin ...
0074       out.azrms out.azsig out.azoff out.elpeak out.elmin out.elrms ...
0075       out.elsig out.eloff];
0076     d.correction.allpoint = outCross;
0077     d.correction.point_out = out;
0078   end
0079   
0080   % and now we save it for posterity
0081 
0082 %% ACT - 24th October - currently commented out cvs option
0083 
0084   parFlag = checkpar(parm, 'autosave');
0085   if(parFlag)
0086     if(parm.autosave.flag)
0087       
0088       %system('cvs update constants/pointing_crosses.txt');
0089       %allCross  = load([home,'/',installeddir,'/constants/',pointing_crosses_filename]);
0090       %allCross  = [allCross; thisCross];
0091       save([home,'/',installeddir,'/constants/',pointing_crosses_filename], 'thisCross', '-ascii', '-single','-append')
0092       save([home,'/',installeddir,'/constants/pointing_crosses.txt'], 'thisCross', '-ascii', '-single','-append')
0093       %system('cvs commit -m "update" constants/pointing_crosses.txt');
0094     
0095     
0096       if(~isempty(out))
0097     %allCross  = load([home,'/',installeddir,'/constants/',pointing_full_data_filename]);
0098     %allCross  = [allCross; outCross];
0099         save([home,'/',installeddir,'/constants/',pointing_full_data_filename], 'thisCross', '-ascii', '-single','-append');
0100     save([home,'/',installeddir,'/constants/pointing_full_data.txt'], 'thisCross', '-ascii', '-single','-append')
0101       end
0102     end
0103   end
0104   display(sprintf('Measured %d good pointing crosses', length(off.az)));
0105   display(sprintf('Mean az/el offset:  %2.3f, %2.3f degrees', nanmean(off.az), nanmean(off.el)));
0106 
0107 else
0108   display('NO GOOD CROSSES IN YOUR DATA SET');
0109   d.correction.pointing = [];
0110 end
0111 
0112 close all;
0113 
0114 d = logcal(d, 'pointing');
0115 
0116 return;
0117 
0118 
0119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0120 function d=checkstatus(d, flags)
0121 
0122 disp('Would you like to view the plots?')
0123 
0124 if (query)
0125   d = packd(d, [], 'none', 'alpha', 0, 'Alpha Plots', '');
0126 end
0127 
0128 disp(' ')
0129 
0130

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