Home > reduc > astrocal.m

astrocal

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function d = astrocal(d)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  function d = astrocal(d)

  converts data to sky temperature (in K);

  Basically takes the noise diode temperature and multiplies our data to
  give us temperature units:
    I1 = I1*(2*TND1)
    I2 = I2*(2*TND2)
    Q/U = Q/U*1/sqrt(2)*sqrt(TND1*TND2)

  this leaves us with:  I1 = Tsky*e^-tau + Tcmb*e^-tau + Tamb(1-e^-tau) -
  Tload1.
    we want to output Tsky + Tcmb - Tload 
    so we subtract off Tamb(1-e^-tau), add Tload, and divide the whole
    mess by exp(-tau), and subtract Tload
  do the same for I2.

   sjcm

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function d = astrocal(d)
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 %  function d = astrocal(d)
0006 %
0007 %  converts data to sky temperature (in K);
0008 %
0009 %  Basically takes the noise diode temperature and multiplies our data to
0010 %  give us temperature units:
0011 %    I1 = I1*(2*TND1)
0012 %    I2 = I2*(2*TND2)
0013 %    Q/U = Q/U*1/sqrt(2)*sqrt(TND1*TND2)
0014 %
0015 %  this leaves us with:  I1 = Tsky*e^-tau + Tcmb*e^-tau + Tamb(1-e^-tau) -
0016 %  Tload1.
0017 %    we want to output Tsky + Tcmb - Tload
0018 %    so we subtract off Tamb(1-e^-tau), add Tload, and divide the whole
0019 %    mess by exp(-tau), and subtract Tload
0020 %  do the same for I2.
0021 %
0022 %   sjcm
0023 %
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 
0026 % first let's get the ambient temperature
0027 Tamb = interp1(d.array.frame.utc, d.array.weather.airTemperature+273.15, ...
0028     d.antenna0.receiver.utc, 'linear', 'extrap');
0029 tau  = d.antenna0.receiver.tau./sind(d.antenna0.servo.el);
0030 Tatm =  Tamb.*(1-exp(-tau));
0031 
0032 % convert the I channels to sky units
0033 I1 = d.antenna0.receiver.data(:,1).*2.*d.antenna0.receiver.noise(:,1);
0034 I1 = I1 - Tatm + d.antenna0.thermal.coldLoad;
0035 I1 = I1./exp(-tau);
0036 I1 = I1 - d.antenna0.thermal.coldLoad;
0037 
0038 I2 = d.antenna0.receiver.data(:,8).*2.*d.antenna0.receiver.noise(:,2);
0039 I2 = I2 - Tatm + d.antenna0.thermal.coldLoad;
0040 I2 = I2./exp(-tau);
0041 I2 = I2 - d.antenna0.thermal.coldLoad;
0042 
0043 % the factor by which we need to convert the polarization channels is given
0044 % by  sqrt(TND1, TND2);
0045 polFactor = sqrt(d.antenna0.receiver.noise(:,1).*d.antenna0.receiver.noise(:,2));
0046 polFactor = repmat(polFactor, [1 6]);
0047 
0048 d.antenna0.receiver.data(:,1) = I1;
0049 d.antenna0.receiver.data(:,8) = I2;
0050 d.antenna0.receiver.data(:,2:7) = ...
0051     d.antenna0.receiver.data(:,2:7).*polFactor;
0052 
0053 
0054 return;

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005