d = calibrate_linearity(d) This function uses the measured detector diode curves to correct for the non-linearity of the detector diodes. To look at the linearity of the data --> convert switchData to Volts then into power using the measured diode response. Then convert back to digital units, because some functions (namely passband functions) expect units in digital units. OGK and ACT, July 2011
0001 function d = calibrate_linearity(d) 0002 % d = calibrate_linearity(d) 0003 % 0004 % This function uses the measured detector diode curves to correct for the 0005 % non-linearity of the detector diodes. 0006 % 0007 % To look at the linearity of the data --> convert switchData to Volts then 0008 % into power using the measured diode response. Then convert back to 0009 % digital units, because some functions (namely passband functions) expect 0010 % units in digital units. 0011 % 0012 % OGK and ACT, July 2011 0013 % 0014 0015 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 % Diode curves as measured by Oliver 0018 % Best fit quadratics: 0019 % 0020 % Input power (mW) = D(1).*x^2 + D(2)*x + D(3) 0021 % 0022 % where x is ouput voltage in V 0023 % 0024 % D is the array of polynomial coefficaient D[12,1:3] 0025 % For diodes 1 to 12 with 3 coefficients each 0026 % 0027 %%%%%%%%%%%%%%%%%%%%%%%%%% 0028 0029 D(1,1:3) = [ 18.480 1.285 0.000]; 0030 D(2,1:3) = [ 17.395 1.244 0.000]; 0031 D(3,1:3) = [ 17.954 1.252 0.000]; 0032 D(4,1:3) = [ 17.501 1.251 0.000]; 0033 D(5,1:3) = [ 19.851 1.391 0.000]; 0034 D(6,1:3) = [ 17.264 1.236 0.000]; 0035 D(7,1:3) = [ 18.786 1.309 0.000]; 0036 D(8,1:3) = [ 17.384 1.251 0.000]; 0037 D(9,1:3) = [ 18.208 1.266 0.000]; 0038 D(10,1:3) = [ 17.357 1.211 0.000]; 0039 D(11,1:3) = [ 17.444 1.217 0.000]; 0040 D(12,1:3) = [ 16.289 1.258 0.000]; 0041 0042 % The average diode has linear slope, used to convert the non-linearity 0043 % corrected power back to a voltage. 0044 % See wiki page http://astrowiki.physics.ox.ac.uk/CBass/DetectorDiode 0045 V2mW = 1.289; % mW/V 0046 0047 % Convert switchData from Backend units to Volts 0048 % To account of the gain of readout and filter board we have a factor of 0049 % 6.5 in the equation, which is the gain of the backend board. 0050 % 4999 digital units corresponds to an input voltage of +1.25V 0051 % Therefore the conversion factor is: 0052 BU2V = 1.25./((10^4)/2)/6.5; % V/DU 0053 0054 d.antenna0.receiver.switchData = d.antenna0.receiver.switchData*BU2V; 0055 0056 % Now use diode calibration curves to go from V to mW input power 0057 % Diodes are in pairs for the 24 channels 0058 % Preallocate power array 0059 P = ones(size(d.antenna0.receiver.switchData)); 0060 0061 for i=1:12 0062 %first channel with this diode 0063 V = d.antenna0.receiver.switchData(:,(2*i)-1); 0064 P(:,(2*i)-1) = ( (D(i,1)*V.^2) + (D(i,2)*V) + D(i,3) ); 0065 clear V 0066 % second channel with this diode 0067 V = d.antenna0.receiver.switchData(:,(2*i)); 0068 P(:,(2*i)) = ( (D(i,1)*V.^2) + (D(i,2)*V) + D(i,3)); 0069 clear V 0070 end 0071 0072 % go back to digital units 0073 P = P/V2mW/BU2V; 0074 d.antenna0.receiver.switchData = P; 0075 0076 clear P 0077 0078 end