0001 function d = overfWrapper(d, plotparams, parm, field);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 setPlotDisplay(plotparams.plot);
0015
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
0024
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
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
0039 parFlag = checkpar(parm, 'autosave');
0040 if(parFlag)
0041
0042 if(parm.autosave.flag & ~isempty(thisScan))
0043
0044 switch(numChan)
0045 case 8
0046
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
0051
0052 case 10
0053
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
0058
0059 end
0060 end
0061
0062 if(parm.autosave.flag & ~isempty(thisNoise))
0063 switch(numChan)
0064 case 8
0065
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
0070
0071 case 10
0072
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
0077
0078 end
0079 end
0080 end
0081
0082
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