Computing Tsys from the telescope archive data.
07mar05
The system temperature is computed from
the calon (tsys + Tcal) and the caloff (Tsys) scans. The
processing is normally:
caloff
TsysK=  * calK
(calOn  calOff)
This is the same as:
let calRatio=calOn/caloff
1.
(1.)
TsysK=  * calK
calratio  1
Rfi in the cal on or cal off can cause problems in the
computation.
It is best to ignore frequency bins that contain rfi. Fitting the
band pass and removing outliers is hard because of the iflo bandpass
shape. The ratio calon/caloff does not have this problem.
Using the following definitions:
Tsky  sky temp, Gsky frquency dependence of sky
temp
Tcal  cal temp, Gcal frequency dependence
of the cal
Tiflo  power from the omt,amps. iflo, Giflo frequency
dependence
The the cal ratio can be written as:
(Tsky*Gsky + Tcal*Gcal + Tiflo )*Giflo
calRatio= 
(Tsky*Gsky + Tiflo )*Giflo
So Giflo cancels. If you assume that Tsky,Gsky is the same for
the on/off
then you get:
(Tcal*Gcal)
calRatio  1 = 
(Tsky*Gsky + Tiflo )
Since Gcal,Gsky is a slowly varying function of frequency (we're
ignoring standing waves since they have little power in them) you can
do a low order fit and throw out any outliers (nsig above the fit residuals).
The procedure is then:

Find all of the calOn scans in the data archive. Ignore :

files with project ID of unknown, a9999, x108, elec since
these are usually testing.

Any polarization scans (since these are stored as acfs and i'm lazy..)

Find an off scan that goes with this cal on. The offs can be:

If this is an calon/off procedure use the off scan

Look for records before and after this scan that are within 4.5 seconds
from the start of the calOn and have the cal off. If one record is found,
use it. If two records are found then use the average.

Compute the calratio CalOn/Caloff (remember that Caloff is Tsys).

Use corblauto
to iteratively fit a linear plus 3rd order harmonic to the ratio throwing
out all points above 3 sigma. Keep iterating till no points are removed.

Store the following for info in the tsys archive each fit:

The scan number that identifies the calon and cal off records. You can
use this to get the full scan info later.

The fit coefficients

The fraction of channels used for the fit.

The rms of the fit. Since it is Tsys+tcal/tsys the units are tsys.

The min/max channel numbers used in the fit (normally the edges are removed
by the fitting process).

The the alfa cal values in 1 Mhz steps from 1220 to 1520 Mhz.

Take 100 points across the inner 80% of each scan. Evaluate the fit at
these points . Also compute the Cal value at these 100 points. Compute
Tsys for these 100 points using (1) and then average
to get Tsys.

Throw out any points where:

Tsys< 20K or Tsys > 100K

The 0 lag was < .5 or gt 3. These numbers are the ratio of measured
to optimum power for the correlation function. If the input power levels
were very low (wrong settings) or high (maybe a continuum source) then
ignore the points.
The routines used to do this are:

tsysfindcals(): find the cal ons and cal offs in the archive

tsysfit(): do the fits

tsysfiteval() : evaluate the fit.

tsyscmpK() : Compute tsys from the fits and the cal values

tsys_gettbl(): get fit data from the tsys archive for a range of months.
This processing also lets you look at the bandpass shape
of calOn/calOff. The fit residuals are typically within 2 sigma of the
radiometer equation. Low frequency ripples in the cal are easily seen.
home_~phil