This is a static copy of a profile reportHome
mainsWrapper (1 call, 47.513 sec)
Generated 05-Aug-2011 13:03:25 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/support/mainsWrapper.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
reduceData | function | 1 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
53 | dcorr = filter_data(dcorr, use... | 72 | 45.556 s | 95.9% |  |
70 | d = packd(dcorr, [], 'none', '... | 1 | 1.913 s | 4.0% |  |
59 | setPlotDisplay(plotparams.plot... | 1 | 0.033 s | 0.1% |  |
64 | if(isempty(find(dcorr.index.bl... | 1 | 0.011 s | 0.0% |  |
85 | return; | 1 | 0 s | 0% |  |
All other lines | | | 0.000 s | 0.0% |  |
Totals | | | 47.513 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
filter_data | function | 72 | 45.524 s | 95.8% |  |
packd | function | 1 | 1.913 s | 4.0% |  |
setPlotDisplay | function | 1 | 0.033 s | 0.1% |  |
checkpar | function | 1 | 0 s | 0% |  |
logcal | function | 2 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.044 s | 0.1% |  |
Totals | | | 47.513 s | 100% | |
Code Analyzer results
Line number | Message |
1 | Extra semicolon is unnecessary. |
64 | To improve performance, replace ISEMPTY(FIND(X)) with ISEMPTY(FIND( X, 1 )). |
70 | The value assigned to variable 'd' might be unused. |
73 | The value assigned to variable 'd' might be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 85 |
Non-code lines (comments, blank lines) | 45 |
Code lines (lines that can run) | 40 |
Code lines that did run | 25 |
Code lines that did not run | 15 |
Coverage (did run/can run) | 62.50 % |
Function listing
time calls line
1 function d = mainsWrapper(d, plotparams, parm, field);
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % function d = mainsWrapper(d, plotparams, parm, field);
6 %
7 % reduceData function that clears the data of the mains hum
8 % This works on the switched data ie use before rfactor and alpha
9 %
10 % sjcm
11 % 4-nov-2010 act : forced to work on switched data
12 %
13 % 30-mar-2011 sjcm: no plotting but can save plots
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
1 16 useSwitch = 1;
17
1 18 [d,q] = logcal(d, 'mains');
1 19 if (q)
20 disp('Mains correction has been applied');
21 disp(' ')
22 % d=checkstatus(d, useSwitch);
23 return
24 end
25
1 26 if(useSwitch)
1 27 numChannels = 24;
28 else
29 numChannels = 6;
30 end
31
32
33
34 % check if we have the flagging parameters
1 35 parFlag = checkpar(parm, 'mains');
1 36 if(parFlag)
1 37 filterParams = reshape(parm.mains.tukey, [4 length(parm.mains.tukey)/4])';
38 else
39 display('Using Default mains filtering parameters about 40Hz (alias of 60Hz mains)');
40 filterParams = [38.9 39.9 40.1 41.1];
41 end
42
43 % THIS METHOD TAKES TOO LONG. LET'S PUT A FILTER ABOUT 60Hz.
44 % now we remove the mains
45 %[mains_factors, indices] = calculate_mains(d, useSwitch);
46 %d.correction.mains.factors = mains_factors;
47 %d.correction.mains.indices = indices;
48
49 % apply the correction.
1 50 dcorr = d;
1 51 for m=1:size(filterParams,1)
3 52 for nn=1:numChannels
45.56 72 53 dcorr = filter_data(dcorr, useSwitch, nn, filterParams(m,1), ...
54 filterParams(m,2), filterParams(m,3), filterParams(m,4), 0);
72 55 end
3 56 end
57
58
0.03 1 59 setPlotDisplay(plotparams.plot);
60
61 % next we plot to see if there was any effect at all
62
63 % only plot data that is on the blank stare
0.01 1 64 if(isempty(find(dcorr.index.blank.fast)))
65 display('No blank data to plot effect of filter');
1 66 else
1 67 display('Plotting Power Spectrum');
1 68 display('No flagging will be allowed');
1 69 if(useSwitch)
1.91 1 70 d = packd(dcorr, [], 'none', 'mainsSwitch', plotparams, 'Main Plots', field, d);
71
72 else
73 d = packd(dcorr, [], 'none', 'mainsReg', plotparams, 'Main Plots', field, d);
74 end
1 75 end
76
77
78
79 % log that it has been applied
1 80 d = dcorr;
81
1 82 d = logcal(d, 'mains');
83
84
1 85 return;
Other subfunctions in this file are not included in this listing.