# Converting spectrometer counts to kelvins

09nov09

Spectral data is recorded in "spectrometer counts" which are linear in  power (using correlators is similar since you
compute the spectrum from the correlations). The cal diodes are then used to convert the spectrometer counts to Kelvins.

## Terminology:

• Bold: variables are arrays with frequency dependence.
• Spc: spectrometer counts
• K:   kelvins
• Avg: the average value  of the spectra (maybe throwing out some  channels at the edges).
• <>:average over the spectra (throwing out points at the edges if you want).
• gCal(f):- frequency dependence of the tabulated cal values. Normalize this to have an average value of unity (maybe throwing out some channels at the edges).
• gIF(f)  - frequency dependence of the if/lo bandpass (i'm ignoring the frequency dependence prior to the cal injection). Normalize this to have an average value of unity (maybe throwing out some channels at the edges).
• One(f) - an array of 1's
• calInK(Avg): Scaler cal value averaged over the band.
• calOffSpc(Avg): cal off value averaged over the band (in spectrometer counts)
• calDif_cnts(f)=(calOn_cnts(f)-calOff_cnts(f)). This is the cal difference spectrum in counts of the spectrometer. It can also be written:
• calDif_cnts(f)=calDif_cnts(Avg)* gCal*gIF.
• calOffSpc_cnts(f)=calOff_cnts(Avg)*gIF
• <gIF(f)> and <gCal(f)> = one by definition.

## Computing the conversion factor:

Standard processing for computing Kelvins from spectrometer counts (cntsToK) is to average over the bandpass so the short integration times of the calOn, calOff don't affect the noise statistics of the  longer integration times of the on,off source spectra. Below we compute the conversion by frequency channel and then do the average:

•
• The calInK frequency dependence has cancelled out. It still contains the IF bandpass frequency dependence.

• cntsToK(avg) = <cntsToK(f)> = calInK(Avg) / (calDif_cnts(Avg) * <gIF>)
• but <gIF> = one by definition. so
• cntsToK(avg) =  calInK(Avg) / (calDif_cnts(Avg))

To convert a spectrum b_cnts in spectrometer counts to b_K in Kelvins using cntsToK:
• b_K(f)=b_cnts(f) * cntsToK(avg)
• b_K(f)=
`              b_cnts(Avg)*gIF * calInK(Avg)              ------------------------------              calDif_cnts(Avg)`
• This still contains the gIF Freq response.
• To remove the frequency response of the  IF you need a bandpass correction that includes gIF. eg normalized  calOff:
• b_K(f)/ (calOff_cnts(f)/<calOff_cnts(f)>)=
```         =b_cnts(Avg)*gIF * calInK(Avg)    (calOff_cnts(Avg)*<gIF>)          ----------------------------- * ------------------          (calDif_cnts(Avg))                calOff_cnts(Avg)*gIF
```
=b_cnts(Avg) * calInK(Avg) * calOff_cnts(Avg) *  one()
------------------------------------------------------------
calDif_cnts(Avg) * (calOff_cnts(Avg)
• This has removed all of the bandpass dependencies
To compute the system temperature you just average over this spectra.

But:
• C = <C> * gIF.
• the value of <C> will depend on the channels used for the average and the type of average (mean,median).
• You can not cancel gIF 's if they have been computed using different channels or types of average.

## An example using this:

• Variables:
• BcalOn_cnts cal on spectra
• BcalOff_cnts cal off spectra
• B_cnts spectra to convert to Kelvins
• TcalAvg_K: average cal value for spectra
• Converting a spectrum to Kelvins:
• cntsToK(avg)= TcalAvg_K/<BcalOn_cnts - BcalOff_cnts>
• B_k = B_cnts * cntsToK(avg) /   bCalOff_cnts/<bCalOff_cnts>
• Converting spectrum to Kelvins then computing average Tsys:
• Before dividing by the normalized calOff spectrum we had:
---------------------------
calDif_cnts(Avg)
• Averaging over the spectra gives:
<b_k> = b_cnts(Avg) * <gIF> * calInK(Avg)
-----------------------------------------------------
calDif_cnts(Avg)
• The frequency dependence is gone. In this case you don't need to divide by <calOff>/calOff since:
• <  <calOff>/ calOff > = <calOff>/<calOff> = 1.
• Doing this using the mean and the median give different results for Tsys.
• Converting on/off position switch data to Kelvins
• Bpon_cnts(f)=(Tsrc_cnts(f) + Tsys_cnts(f))*gIF  on source
• Bpoff_cnts(f)=(Tsys_cnts(f))*gIF  off Position
• Bsrc_tsys(f)=(Bpon_cnts/Bpoff_cnts -1)=Tsrc_cnts(f)/Tsys_cnts(f)
• This is now in units of Tsys. The gIF has cancelled out.
• Bsrc_K(f)= (Tsrc_cnts(f)/Tsys_cnts(f)-1)  *X * (calInK(avg)/(calDif_cnts(avg)).
• We Need X to convert from Tsys units back to cnts since cntsToK(avg) converts from _cnts to K.
• X=mean(Bpoff_cnts(f)) = <Bpoff_cnts(avg)*<gIF> > = Bpoff_cnts(avg)
• Bsrc_K(f)=(Bpon_cnts(f)/BpOff_cnts(f) - 1) * (<BpOff_cnts(f)>) * CalInK(avg)/caldif_cnts(avg)
• All of the averages should use the same spectral channels (in case you throw away some channels because of rfi).

## Computing the conversion from Spc to Kelvins by frequency channel.

The above computation used the  average cal value for the conversion. If we wanted to compute the cntsToK for each frequency channel (and not worry about the increase in noise by the short calon,caloff integrations):
• cntsToK(f) =
--------------------
calDif_cnts(Avg)*gIF

• b_K(f)          =