This is a static copy of a profile report

Home

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)

Function NameFunction TypeCalls
loadWrapperfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
34
shifted_load = circshift(load_...
100.481 s32.6%
70
d.antenna0.receiver.data(t_sta...
100.284 s19.3%
30
load_res = d.antenna0.thermal....
100.251 s17.0%
38
residual = d.antenna0.receiver...
100.230 s15.6%
36
correction = K_best(chan)*(shi...
100.219 s14.8%
All other lines  0.011 s0.7%
Totals  1.476 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
circshiftfunction100.481 s32.6%
meanfunction200.120 s8.1%
Self time (built-ins, overhead, etc.)  0.874 s59.3%
Totals  1.476 s100% 
Code Analyzer results
Line numberMessage
38The value assigned to variable 'residual' might be unused.
Coverage results
[ Show coverage for parent directory ]
Total lines in function85
Non-code lines (comments, blank lines)72
Code lines (lines that can run)13
Code lines that did run12
Code lines that did not run1
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.