Home > reduc > support > overfWrapper.m

overfWrapper

PURPOSE ^

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

SYNOPSIS ^

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

DESCRIPTION ^

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

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

    reduceData function that does 1/f plot

    sjcm

    3/30/2011 sjcm : saving plots wihtout display
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function d = overfWrapper(d, plotparams, parm, field);
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 %  function d = overfWrapper(d, plotparams, parm, field);
0006 %
0007 %    reduceData function that does 1/f plot
0008 %
0009 %    sjcm
0010 %
0011 %    3/30/2011 sjcm : saving plots wihtout display
0012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0013 
0014 setPlotDisplay(plotparams.plot);
0015 % there is no flagging on this step
0016 display('Calculating and plotting 1/f');
0017 display('No flagging will be allowed');
0018 
0019 stats = plot1overf(d, plotparams, field);
0020 
0021 d.correction.overf.stat = stats;
0022 
0023 % next we save for posterity
0024 % first the scan 1/f parameters, removing bad ones.
0025 indBad = mean(isnan(stats.scan.fknee),2)==1;
0026 scan = structcut(stats.scan, ~indBad);
0027 numChan = size(scan.fknee,2);
0028 thisScan = [scan.mjd scan.fknee scan.alpha scan.white scan.errorFlags];
0029 
0030 
0031 % and the noise
0032 indBad = mean(isnan(stats.noise.fknee),2)==1;
0033 noise = structcut(stats.noise, ~indBad);
0034 thisNoise = [noise.mjd noise.fknee noise.alpha noise.white noise.errorFlags];
0035 
0036 [home,installeddir]=where_am_i();
0037 
0038 % make sure file is up-to-date
0039 parFlag = checkpar(parm, 'autosave');
0040 if(parFlag)
0041 
0042   if(parm.autosave.flag & ~isempty(thisScan))
0043     
0044     switch(numChan)
0045       case 8
0046     %system('cvs update constants/overf_scan_8chan.txt');
0047     allScan  = load([home,'/',installeddir,'/constants/overf_scan_8chan.txt']);
0048     allScan  = [allScan; thisScan];
0049     save([home,'/',installeddir,'/constants/overf_scan_8chan.txt'], 'allScan', '-ascii', '-single')
0050     %system('cvs commit -m "update" constants/overf_scan_8chan.txt');
0051     
0052       case 10
0053     %system('cvs update constants/overf_scan_10chan.txt');
0054     allScan  = load([home,'/',installeddir,'/constants/overf_scan_10chan.txt']);
0055     allScan  = [allScan; thisScan];
0056     save([home,'/',installeddir,'/constants/overf_scan_10chan.txt'], 'allScan', '-ascii', '-single')
0057     %system('cvs commit -m "update" constants/overf_scan_10chan.txt');
0058 
0059     end
0060   end
0061   
0062   if(parm.autosave.flag & ~isempty(thisNoise))
0063     switch(numChan)
0064       case 8
0065     %system('cvs update constants/overf_noise_8chan.txt');
0066     allNoise  = load([home,'/',installeddir,'/constants/overf_noise_8chan.txt']);
0067     allNoise  = [allNoise; thisNoise];
0068     save([home,'/',installeddir,'/constants/overf_noise_8chan.txt'], 'allNoise', '-ascii', '-single')
0069     %system('cvs commit -m "update" constants/overf_noise_8chan.txt');
0070     
0071       case 10
0072     %system('cvs update constants/overf_noise_10chan.txt');
0073     allNoise  = load([home,'/',installeddir,'/constants/overf_noise_10chan.txt']);
0074     allNoise  = [allNoise; thisNoise];
0075     save([home,'/',installeddir,'/constants/overf_noise_10chan.txt'], 'allNoise', '-ascii', '-single')
0076     %system('cvs commit -m "update" constants/overf_noise_10chan.txt');
0077 
0078     end
0079   end
0080 end
0081  
0082 % log that it has been applied
0083 d = logcal(d, 'overf');
0084 
0085 
0086 return;
0087 
0088 
0089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0090 function d=checkstatus(d, useSwitch)
0091 
0092 disp('Would you like to view the plots?')
0093 
0094 if (query)
0095   if(useSwitch)
0096     d = packd(d, [], 'none', 'mainsSwitch', 0, 'Main Plots', '');
0097   else
0098     d = packd(d, [], 'none', 'mainsReg', 0, 'Main Plots', '');  
0099   end
0100 end
0101 
0102 disp(' ')
0103 
0104

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