This is a static copy of a profile reportHome
alphaWrapper (1 call, 11.630 sec)
Generated 05-Aug-2011 13:03:25 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/support/alphaWrapper.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 |
77 | d = applyAlpha_database_DD(d);... | 1 | 4.197 s | 36.1% |  |
94 | [d, outFlags] = packd(d, flags... | 1 | 4.044 s | 34.8% |  |
46 | isup2date = checkAlphaDatabase... | 1 | 2.700 s | 23.2% |  |
57 | [off1StartPos onEndPos off2End... | 1 | 0.230 s | 2.0% |  |
96 | d = updateFlags(d, 1); | 1 | 0.131 s | 1.1% |  |
All other lines | | | 0.328 s | 2.8% |  |
Totals | | | 11.630 s | 100% | |
Children (called functions)
Code Analyzer results
Line number | Message |
1 | Extra semicolon is unnecessary. |
26 | The value assigned to variable 'flagParams' might be unused. |
31 | The value assigned to variable 'flagParams' might be unused. |
40 | The value assigned to variable 'autoFlag' might be unused. |
42 | The value assigned to variable 'autoFlag' might be unused. |
72 | The value assigned here to 'Td' appears to be unused. Consider replacing it by ~. |
72 | The value assigned here to 'rd' appears to be unused. Consider replacing it by ~. |
72 | The value assigned here to 'hrz' appears to be unused. Consider replacing it by ~. |
72 | The value assigned to variable 'equ' might be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 120 |
Non-code lines (comments, blank lines) | 55 |
Code lines (lines that can run) | 65 |
Code lines that did run | 32 |
Code lines that did not run | 33 |
Coverage (did run/can run) | 49.23 % |
Function listing
time calls line
1 function d = alphaWrapper(d, plotparams, parm, field);
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % function d = alphaWrapper(d, plotparams, parm, field);
6 %
7 % reduceData function that calls the alpha calculation and flagging
8 % acording to parameters parm.
9 %
10 % sjcm
11 %
12 % 3/30/2011 sjcm: can now save plots without displaying them.
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
1 15 [d,q] = logcal(d, 'alpha');
1 16 if (q)
17 disp('Alpha correction has been applied');
18 disp(' ')
19 d=checkstatus(d);
20 return
21 end
22
23 % check if we have the flagging parameters
1 24 parFlag = checkpar(parm, 'alpha');
1 25 if(parFlag)
1 26 flagParams = [parm.alpha.jump parm.alpha.flat];
1 27 alphaType = parm.alpha.type;
1 28 solveAlpha = parm.alpha.solve;
29 else
30 display('No flagging in alpha correction');
31 flagParams = [1.5 0.004];
32 display('No alpha correction type specified, defaulting to 1');
33 alphaType = 1;
34 solveAlpha = 0;
35 end
36
37 % check if we're autoflagging
0.01 1 38 autoFlag = checkpar(parm, 'autorun');
1 39 if(autoFlag)
1 40 autoFlag = parm.autorun.flag;
41 else
42 autoFlag = 0;
43 end
44
45
2.70 1 46 isup2date = checkAlphaDatabase((d.array.frame.utc(1)));
1 47 if(~isup2date)
48 % check if we're running it interactively
49 if(plotparams.interactive==1)
50 display('Your alpha database is not up to snuff');
51 display('Would you like to solve it from the data in this track?');
52 solveAlpha = query;
53 end
54 end
55
56 % needed for plotting/flagging -- even in other routines.
0.23 1 57 [off1StartPos onEndPos off2EndPos onStartPos off1EndPos off2StartPos] = calcNoiseIndices(d);
1 58 d.correction.alpha.indices = [off1StartPos onEndPos off2EndPos onStartPos];
1 59 d.correction.alpha.indices2 = [off1StartPos onEndPos off2EndPos onStartPos ...
60 off1EndPos off2StartPos];
61
62 % need to assemble the streams so we can either correct it or not.
63 % if we don't do this, the plotting will be messed up.
1 64 switch(alphaType)
65 % note you can specify whatever routine you'd like by changing the proper
66 % value in redScript.red
67
1 68 case 1
0.11 1 69 d = assembleAlphaStreams_DD(d);
70 % check if we want to solve it from this data set.
1 71 if(solveAlpha)
72 [td,Ad,Gd,Td,rd,hrz,equ] = calculateAlpha_DD(d);
73 d = applyAlpha_DD(d, td, Ad, Gd);
1 74 else
75 % oliver's alpha correction
76 % alpha should be in the database at this point.
4.20 1 77 d = applyAlpha_database_DD(d);
1 78 printDisclaimer1;
1 79 end
1 80 flags.old.bit = d.flags.bit;
1 81 flags.new.bit.fast = zeros(size(flags.old.bit.fast));
82
83
84 % next we plot only the noise source events, and flag whichever ones are
85 % bad. After we're done flagging, we strike those values of alpha which are
86 % offending, re-apply the alpha correction, and then save the resulting
87 % stuff.
0.05 1 88 setPlotDisplay(plotparams.plot);
1 89 display('Plotting data');
90
91
92 %d.history{length(d.history)+1}='Alpha Correct:: Data format is now TSKY_1 TLOAD_1 U Q U Q <U> <Q> TSKY_2 TLOAD_2';
93
4.04 1 94 [d, outFlags] = packd(d, flags, 'none', 'alpha', plotparams, 'Alpha Plots', field);
0.12 1 95 d = setNewFlag(d, outFlags.new.out, 'alpha');
0.13 1 96 d = updateFlags(d, 1);
97 % log that it has been applied
1 98 d = logcal(d, 'alpha');
99
100
101 case 2
102 d = assembleAlphaStreams_PolOnly(d);
103
104 if(solveAlpha)
105 [t2,A2,G2] = calculateAlpha_PolOnly(d);
106 applyAlpha_PolOnly(d, t2, A2, G2);
107 end
108 % oliver filled this in
109 % d = applyAlpha_database_PolOnly(d);
110 display('No plot for you');
111 printDisclaimer2;
112
113
114 %d.history{length(d.history)+1}= 'Alpha Correct:: Data format is now TSKY_1-TLOAD_1 U Q U Q <U> <Q> TSKY_2-TLOAD_2';
115
116 d = logcal(d, 'alpha_PolOnly');
117
118 end
119
1 120 return;
Other subfunctions in this file are not included in this listing.