This is a static copy of a profile report

Home

gainWrapper (1 call, 0.743 sec)
Generated 05-Aug-2011 13:01:17 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/support/gainWrapper.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
reduceDatafunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
63
[d gainflag] = packd(d, gainfl...
10.372 s50.0%
88
allGain  = load('constants/gai...
10.186 s25.0%
90
save([home,'/',installeddir,'/...
10.066 s8.8%
30
gains = calculateGains(d);
10.044 s5.9%
60
setPlotDisplay(plotparams.plot...
10.033 s4.4%
All other lines  0.044 s5.9%
Totals  0.743 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
packdfunction10.372 s50.0%
calculateGainsfunction10.044 s5.9%
setPlotDisplayfunction10.033 s4.4%
flagGainfunction10.022 s2.9%
issubfieldfunction10.011 s1.5%
where_am_ifunction10 s0%
checkparfunction20 s0%
Self time (built-ins, overhead, etc.)  0.262 s35.3%
Totals  0.743 s100% 
Code Analyzer results
Line numberMessage
1Extra semicolon is unnecessary.
71Use || instead of | as the OR operator in (scalar) conditional statements.
86Use && instead of & as the AND operator in (scalar) conditional statements.
89The value assigned to variable 'allGain' might be unused.
Coverage results
[ Show coverage for parent directory ]
Total lines in function100
Non-code lines (comments, blank lines)42
Code lines (lines that can run)58
Code lines that did run31
Code lines that did not run27
Coverage (did run/can run)53.45 %
Function listing
   time   calls  line
1 function d = gainWrapper(d, plotparams, parm, field);
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % function d = gainWrapper(d, plotparams, parm, field);
6 %
7 % reduceData function that calls functions to calculate gain
8 %
9 % sjcm
10 %
11 % 3/30/2011 sjcm: saving plots without display
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 % by this point, we should already have the system temperature values.
0.01 1 15 if(~issubfield(d, 'correction', 'tsys'))
16 display('System temperatures not present');
17 display('Assuming this is a survey track');
18 d.correction.survey = 1;
19 end
20
1 21 if(size(d.antenna0.receiver.data,2)==8)
22 display('No noise diode temps means no gain calculations for you!');
23 return;
24 end
25
26
1 27 if(d.correction.survey)
28 % calculate gains should load up the latest value of the noise diode, and
29 % calculate the gains based on that
0.04 1 30 gains = calculateGains(d);
1 31 d.correction.gain = gains;
1 32 d.correction.gain.flag = zeros(size(gains.val));
33 else
34 tsysGains = d.correction.tsys.gaindB;
35 time = [tsysGains(:,1); tsysGains(:,4)];
36 val = [tsysGains(:,2:3); tsysGains(:,5:6)];
37 flag = [d.correction.tsys.flag; d.correction.tsys.flag];
38
39 % next we put htem in time order.
40 [time I] = sort(time);
41 val = val(I,:);
42 flag = flag(I,:);
43
44 d.correction.gain.time = time;
45 d.correction.gain.val = val;
46 d.correction.gain.flag = flag;
47 end
48
49 % first we flag the gains, if needed
50 % next we flag
1 51 parFlag = checkpar(parm, 'gain');
1 52 if(parFlag)
1 53 flagParams = [parm.gain.min parm.gain.max parm.gain.sigma];
54 else
55 display('Using Default Gain Flagging parameters');
56 flagParams = [100 200 3];
57 end
0.03 1 58 [gainflag] = flagGain(d.correction.gain, flagParams);
59
0.03 1 60 setPlotDisplay(plotparams.plot);
61 % all flagging has already happened in the tsys step, so we just plot.
1 62 display('Plotting data');
0.37 1 63 [d gainflag] = packd(d, gainflag, 'none', 'gain', plotparams, 'Gain Plots', field);
1 64 d.correction.gain.flag = gainflag;
65
66 % next we write things to disk
1 67 thisGain = d.correction.gain.val;
1 68 thisGain(d.correction.gain.flag>0) = nan;
1 69 thisGain = [d.correction.gain.time thisGain];
70
1 71 if(all(d.correction.gain.flag(:)) | d.correction.tsys.allbad==1)
72 display('ATTENTION --- ATTENTION --- ATTENTION');
73 display('No good gain values in your data');
74 display('This data set will not be used for calibration');
75 d.correction.gain.allbad = 1;
1 76 else
1 77 d.correction.gain.allbad = 0;
1 78 end
79
80
1 81 [home,installeddir]=where_am_i();
82
83 % make sure file is up-to-date
1 84 parFlag = checkpar(parm, 'autosave');
1 85 if(parFlag)
1 86 if(parm.autosave.flag & d.correction.gain.allbad==0)
87 %system('cvs update constants/gain_values.txt');
0.19 1 88 allGain = load('constants/gain_values.txt');
1 89 allGain = [allGain; thisGain];
0.07 1 90 save([home,'/',installeddir,'/constants/gain_values.txt'],'allGain', '-ascii','-single');
91 %system('cvs commit -m "update" constants/gain_values.txt');
1 92 end
1 93 end
94
95
96
97
98
99
1 100 return;

Other subfunctions in this file are not included in this listing.