This is a static copy of a profile reportHome
apply_loadcorrect_final (1 call, 1.476 sec)
Generated 05-Aug-2011 13:00:59 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/apply_loadcorrect_final.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
34 | shifted_load = circshift(load_... | 10 | 0.481 s | 32.6% |  |
70 | d.antenna0.receiver.data(t_sta... | 10 | 0.284 s | 19.3% |  |
30 | load_res = d.antenna0.thermal.... | 10 | 0.251 s | 17.0% |  |
38 | residual = d.antenna0.receiver... | 10 | 0.230 s | 15.6% |  |
36 | correction = K_best(chan)*(shi... | 10 | 0.219 s | 14.8% |  |
All other lines | | | 0.011 s | 0.7% |  |
Totals | | | 1.476 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
circshift | function | 10 | 0.481 s | 32.6% |  |
mean | function | 20 | 0.120 s | 8.1% |  |
Self time (built-ins, overhead, etc.) | | | 0.874 s | 59.3% |  |
Totals | | | 1.476 s | 100% | |
Code Analyzer results
Line number | Message |
38 | The value assigned to variable 'residual' might be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 85 |
Non-code lines (comments, blank lines) | 72 |
Code lines (lines that can run) | 13 |
Code lines that did run | 12 |
Code lines that did not run | 1 |
Coverage (did run/can run) | 92.31 % |
Function listing
time calls line
1 function [d]= apply_loadcorrect_final(d,K_best,shift)
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % function [d] = apply_loadcorrect_final(d,K_best,shift)
6 %
7 % To apply the correction factor to remove the effect
8 % of fluctuations in the cold load
9 %
10 % Do this on each of the 12 switched channels
11 %
12 % Should check this works over various timescales/ conditions before
13 % releasing as final
14 %
15 % act
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
18
19 %Double check lengths of arrays
20
1 21 t_start = 1;
0.01 1 22 t_stop = length(d.antenna0.thermal.coldLoad(:,1));
23
24
1 25 for chan = 1:size(d.antenna0.receiver.data,2)
26
27 % Get corrections and residuals (check at the moment for plots - can
28 % remove at later date)
29
0.25 10 30 load_res = d.antenna0.thermal.coldLoad(t_start:t_stop) - mean(d.antenna0.thermal.coldLoad(t_start:t_stop));
31
32 %shifted_load = circshift(d.antenna0.thermal.coldLoad,shift(chan));
33
0.48 10 34 shifted_load = circshift(load_res,shift(chan));
35
0.22 10 36 correction = K_best(chan)*(shifted_load - mean(shifted_load));
37
0.23 10 38 residual = d.antenna0.receiver.data(t_start:t_stop,chan) - ((d.antenna0.receiver.data(t_start:t_stop,chan))- correction);
39
40
41 % Some spectrogram plots to check
42 %
43 % figure(chan)
44 %
45 %
46 % subplot(2,2,1)
47 %
48 % spectrogram(d.antenna0.receiver.pairedData(:,chan),512,16 ,512,100)
49 % xlim([0 50])
50 % title('Spectra of original data');
51 %
52 % subplot(2,2,2)
53 %
54 % spectrogram(d.antenna0.thermal.coldLoad(:),512,16 ,512,100)
55 % xlim([0 50])
56 % title('Spectra of cold load data');
57 %
58 % subplot(2,2,4)
59 %
60 % spectrogram(residual,512,16 ,512,100)
61 % title('Spectra of residual data - should essentially be load correction')
62 % xlim([0 50])
63 %
64 % % Apply correction to channel data
65 %
10 66 if(isfield(d.antenna0.receiver, 'dataT'))
67 d.antenna0.receiver.dataT(t_start:t_stop,chan) = ...
68 (d.antenna0.receiver.dataT(t_start:t_stop,chan))- correction;
10 69 else
0.28 10 70 d.antenna0.receiver.data(t_start:t_stop,chan) = ...
71 (d.antenna0.receiver.data(t_start:t_stop,chan))- correction;
10 72 end
73
74 %
75 % %
76 % subplot(2,2,3)
77 % %figure
78 % titlenumber = num2str(chan);
79 % spectrogram(d.antenna0.receiver.pairedData(:,chan),512,16 ,512,100)
80 % title('Spectra of corrected data')
81 % xlim([0 50])
82 % suplabel(['Channel ',titlenumber] ,'t');
83 %
84
10 85 end
Other subfunctions in this file are not included in this listing.