This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
tauCalWrapperfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
31
dc = framecut(d, ind);
30.536 s87.5%
22
[si ei] = findStartStop(d.inde...
10.044 s7.1%
36
tauZen = calcOpacity(frequency...
30.033 s5.4%
47
return;
10 s0%
44
end
30 s0%
All other lines  0 s0%
Totals  0.612 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
framecutfunction30.536 s87.5%
calcOpacityMEX-file30.033 s5.4%
findStartStopfunction10.033 s5.4%
meanfunction90 s0%
Self time (built-ins, overhead, etc.)  0.011 s1.8%
Totals  0.612 s100% 
Code Analyzer results
Line numberMessage
15Using ISEMPTY is usually faster than comparing LENGTH to 0.
43The variable 'tauVals' appears to change size on every loop iteration. Consider preallocating for speed.
50This statement (and possibly following ones) cannot be reached.
Coverage results
[ Show coverage for parent directory ]
Total lines in function97
Non-code lines (comments, blank lines)44
Code lines (lines that can run)53
Code lines that did run21
Code lines that did not run32
Coverage (did run/can run)39.62 %
Function listing
   time   calls  line
1 function tauVals = calculateTau(d)
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % function tauVals = calculateTau(d)
6 %
7 % calculates the opacity values from our track
8 %
9 % sjcm
10 %
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12
13
14 % first we see if there's any skydip data
1 15 if(length(find(d.index.skydip.fast))==0)
16 display('no sky dips in your data');
17 tauVals = [];
18 return;
19 end
20
21 % select the data (finding the start and stop points)
0.04 1 22 [si ei] = findStartStop(d.index.skydip.fast);
23
24
25 % SJCM's calc of theoretical
1 26 tauVals = [];
1 27 for m=1:length(si)
3 28 ind = zeros(size(d.index.skydip.fast));
3 29 ind(si(m):ei(m)) = 1;
3 30 ind = logical(ind);
0.54 3 31 dc = framecut(d, ind);
3 32 temp = dc.array.weather.airTemperature + 273.15;
3 33 relHumid = dc.array.weather.relativeHumidity;
3 34 frequency = 5;
35
0.03 3 36 tauZen = calcOpacity(frequency, temp, relHumid, length(temp), length(frequency));
3 37 tauZen = mean(tauZen);
3 38 el = mean(dc.antenna0.servo.el);
3 39 az = mean(dc.antenna0.servo.az);
3 40 Tg = nan;
3 41 utc = dc.array.frame.utc(1);
3 42 thisEntry = [utc az el tauZen tauZen Tg Tg];
3 43 tauVals = [tauVals;thisEntry];
3 44 end
45
46
1 47 return;
48
49 % now we loop over each event, and calculate the opacity
50 for m=1:length(si)
51 ind = zeros(size(d.index.skydip.fast));
52 ind(si(m):ei(m)) = 1;
53 ind = logical(ind);
54 dc = framecut(d, ind);
55
56 % apply the flags we already have
57 %dc = applyFlags(dc);
58
59 % We only want to do this on the sky signals (dataT(:,[1 1]))
60 y = dc.antenna0.receiver.data(:,[1 1 ]);
61
62 % next we want to plot this value against 1/cos(el)
63 x = 1./(cosd(dc.antenna0.servo.el));
64 % now we fit a line to this, the value at the intercept, in these units,
65 % is Tground/Tambient, the slope is tau
66
67 % remove the values that are nan'ed.
68 for mm=1:2
69 thisX = x;
70 thisY = y(:,mm);
71 thisX(isnan(thisY)) = [];
72 thisY(isnan(thisY)) = [];
73
74 if(~isempty(thisY))
75 [slope(m,mm) intercept(m,mm)] = linfit(thisX, thisY);
76 else
77 tau(m,mm) = nan;
78 Tground(m,mm) = nan;
79 end
80 end
81
82 Tamb(m) = mean(dc.array.weather.airTemperature);
83 az(m) = mean(dc.antenna0.servo.az);
84 el(m) = mean(dc.antenna0.servo.el);
85 time(m) = dc.antenna0.servo.utc(1);
86 end
87
88
89 tau = slope./(k_b*10^(13.2)*1e9)/(Tamb+273.15-2.718);
90
91
92
93 Tg = Tground.*repmat(Tamb', [1 2]);
94
95 tauVals = [time' az' el' tau Tg];
96
97 return;

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