This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
reduceData>checkFlagssubfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
73
P = P/V2mW/BU2V;
10.273 s37.3%
54
d.antenna0.receiver.switchData...
10.098 s13.4%
59
P = ones(size(d.antenna0.recei...
10.087 s11.9%
68
P(:,(2*i)) = ( (D(i,1)*V.^2) +...
120.077 s10.4%
64
P(:,(2*i)-1) = ( (D(i,1)*V.^2)...
120.077 s10.4%
All other lines  0.120 s16.4%
Totals  0.732 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function78
Non-code lines (comments, blank lines)50
Code lines (lines that can run)28
Code lines that did run28
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
   time   calls  line
1 function d = calibrate_linearity(d)
2 % d = calibrate_linearity(d)
3 %
4 % This function uses the measured detector diode curves to correct for the
5 % non-linearity of the detector diodes.
6 %
7 % To look at the linearity of the data --> convert switchData to Volts then
8 % into power using the measured diode response. Then convert back to
9 % digital units, because some functions (namely passband functions) expect
10 % units in digital units.
11 %
12 % OGK and ACT, July 2011
13 %
14
15
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17 % Diode curves as measured by Oliver
18 % Best fit quadratics:
19 %
20 % Input power (mW) = D(1).*x^2 + D(2)*x + D(3)
21 %
22 % where x is ouput voltage in V
23 %
24 % D is the array of polynomial coefficaient D[12,1:3]
25 % For diodes 1 to 12 with 3 coefficients each
26 %
27 %%%%%%%%%%%%%%%%%%%%%%%%%%
28
1 29 D(1,1:3) = [ 18.480 1.285 0.000];
1 30 D(2,1:3) = [ 17.395 1.244 0.000];
1 31 D(3,1:3) = [ 17.954 1.252 0.000];
1 32 D(4,1:3) = [ 17.501 1.251 0.000];
1 33 D(5,1:3) = [ 19.851 1.391 0.000];
1 34 D(6,1:3) = [ 17.264 1.236 0.000];
1 35 D(7,1:3) = [ 18.786 1.309 0.000];
1 36 D(8,1:3) = [ 17.384 1.251 0.000];
1 37 D(9,1:3) = [ 18.208 1.266 0.000];
1 38 D(10,1:3) = [ 17.357 1.211 0.000];
1 39 D(11,1:3) = [ 17.444 1.217 0.000];
1 40 D(12,1:3) = [ 16.289 1.258 0.000];
41
42 % The average diode has linear slope, used to convert the non-linearity
43 % corrected power back to a voltage.
44 % See wiki page http://astrowiki.physics.ox.ac.uk/CBass/DetectorDiode
1 45 V2mW = 1.289; % mW/V
46
47 % Convert switchData from Backend units to Volts
48 % To account of the gain of readout and filter board we have a factor of
49 % 6.5 in the equation, which is the gain of the backend board.
50 % 4999 digital units corresponds to an input voltage of +1.25V
51 % Therefore the conversion factor is:
1 52 BU2V = 1.25./((10^4)/2)/6.5; % V/DU
53
0.10 1 54 d.antenna0.receiver.switchData = d.antenna0.receiver.switchData*BU2V;
55
56 % Now use diode calibration curves to go from V to mW input power
57 % Diodes are in pairs for the 24 channels
58 % Preallocate power array
0.09 1 59 P = ones(size(d.antenna0.receiver.switchData));
60
1 61 for i=1:12
62 %first channel with this diode
0.04 12 63 V = d.antenna0.receiver.switchData(:,(2*i)-1);
0.08 12 64 P(:,(2*i)-1) = ( (D(i,1)*V.^2) + (D(i,2)*V) + D(i,3) );
0.01 12 65 clear V
66 % second channel with this diode
0.04 12 67 V = d.antenna0.receiver.switchData(:,(2*i));
0.08 12 68 P(:,(2*i)) = ( (D(i,1)*V.^2) + (D(i,2)*V) + D(i,3));
0.01 12 69 clear V
12 70 end
71
72 % go back to digital units
0.27 1 73 P = P/V2mW/BU2V;
1 74 d.antenna0.receiver.switchData = P;
75
0.01 1 76 clear P
77
1 78 end