0001 function d = mainsWrapper(d, plotparams, parm, field);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 useSwitch = 1;
0017
0018 [d,q] = logcal(d, 'mains');
0019 if (q)
0020 disp('Mains correction has been applied');
0021 disp(' ')
0022
0023 return
0024 end
0025
0026 if(useSwitch)
0027 numChannels = 24;
0028 else
0029 numChannels = 6;
0030 end
0031
0032
0033
0034
0035 parFlag = checkpar(parm, 'mains');
0036 if(parFlag)
0037 filterParams = reshape(parm.mains.tukey, [4 length(parm.mains.tukey)/4])';
0038 else
0039 display('Using Default mains filtering parameters about 40Hz (alias of 60Hz mains)');
0040 filterParams = [38.9 39.9 40.1 41.1];
0041 end
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 dcorr = d;
0061 for m=1:size(filterParams,1)
0062 for nn=1:numChannels
0063 dcorr = filter_data(dcorr, useSwitch, nn, filterParams(m,1), ...
0064 filterParams(m,2), filterParams(m,3), filterParams(m,4), 0);
0065 end
0066 end
0067
0068
0069 setPlotDisplay(plotparams.plot);
0070
0071
0072
0073
0074 if(isempty(find(dcorr.index.blank.fast)))
0075 display('No blank data to plot effect of filter');
0076 else
0077 display('Plotting Power Spectrum');
0078 display('No flagging will be allowed');
0079 if(useSwitch)
0080 d = packd(dcorr, [], 'none', 'mainsSwitch', plotparams, 'Main Plots', field, d);
0081
0082 else
0083 d = packd(dcorr, [], 'none', 'mainsReg', plotparams, 'Main Plots', field, d);
0084 end
0085 end
0086
0087
0088
0089
0090 d = dcorr;
0091
0092 d = logcal(d, 'mains');
0093
0094
0095 return;
0096
0097
0098
0099 function d=checkstatus(d, useSwitch)
0100
0101 disp('Would you like to view the plots?')
0102
0103 if (query)
0104 if(useSwitch)
0105 d = packd(d, [], 'none', 'mainsSwitch', 0, 'Main Plots', '');
0106 else
0107 d = packd(d, [], 'none', 'mainsReg', 0, 'Main Plots', '');
0108 end
0109 end
0110
0111 disp(' ')
0112
0113