# Spectrometer counts to kelvins for widebands.

29jun09

Note: see converting spectrometer counts to Kelvins for a more recent and correct version of this.

The standard spectrometer counts to kelvins conversion uses an average cal value for the band. For the interim correlator and wapp spectra the cal value was that at the center of the band rather than the average over the band. With the mock spectrometer, the bandwidths can now be up to 172 Mhz. The cal variations over the band can start to be important.

### Terminology:

We need to compute the conversion factor spectralCntToK (Kelvins/spectrometer counts..i'm using spcToK). The calOn, calOff measurements are used to do this. The measurements have various frequency dependencies. Below i've used bold for arrays and regular type for scalers
• Let Spc be in spectrometer counts
• K be in Kelvins
• Avg: be 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)
• calDifSpc(f)=(calOnSpc(f)-calOffSpc(f)). It can also be written:
• calDifSpc(f)=calDifSpc(Avg)* gCal*gIF.
• calOffSpc(f)=calOffSpc(Avg)*gIF

# Averaging over calOn,calOff band (top)

We need to compute the conversion factor spectralCntToK (Kelvins/spectrometer counts..i'm using spcToK). The calOn, calOff measurements are used to do this. The measurements have various frequency dependencies. Below i've used bold for arrays and regular type for scalers
• Let Spc be in spectrometer counts
• K be in Kelvins
• Avg: be 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)
• calDifSpc(f)=(calOnSpc(f)-calOffSpc(f)). It can also be written:
• calDifSpc(f)=calDifSpc(Avg)* gCal*gIF.
• calOffSpc(f)=calOffSpc(Avg)*gIF
Standard processing for computing the spcToK conversion 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:
• spcToK=
`	calInK(Avg)*<gCal>           calInK(Avg)        -------------------------  = -----------       (calDifSpc(Avg)*<gIf*gCal>     calDifSpc(Avg)*<gIF>`
• This still contains the average over the IF bandpass.
To convert a spectrum bSpc in spectrometer counts to bK in Kelvins:
• bK(f)=bSpc(f) * spcToK
• bK(Avg)*gIF=
`        bSpc(Avg)*gIF] * calInK(Avg)         ------------------------------        calDifSpc(Avg)*<gIF>`
• This still contains the gIF Freq response as well as the averages over <gIF>
• To remove the frequency respone, divide by normalized the calOff
• bk(f)/ (calOff(f)/<calOff(f)>)=
```         =bSpc(Avg)*gIF * calInK(Avg)    (calOff(Avg)*<gIF>)          ----------------------------- * ------------------          (calDifSpc(Avg)*<gIF>)          calOff(Avg)*gIF
```
`	  =bSpc(Avg)*(calInK(Avg) * calOff(Avg)           ------------------------------------  * One(f)           calDifSpc(Avg) * (calOff(Avg)`
• This has removed all of the bandpass dependencies
To compute the system temperature you just average over this spectra.

This assumes that the cal value is constant over the entire band. For narrow bands this is probably ok, for wider bands it could be a problem. Prior to the mock spectrometer our maximum bandwidth was 100 MHz. The mock spectrometer can provide up to a 172 Mhz single bandwidth.

# Fit to the calOn,calOff scale factor  (top)

A second approach would be to fit the ratio calInK/(calOn-calOff) and use the fit values for the conversion. The safest fit is a linear one where you don't have to worry about what happens to the values at the edge of the band.  To do this correctly we need to be careful about the frequency dependencies in the measurements:
• Using the following abbreviations:
• gCal - frequency dependence of the tabulated cal values
• gIF  - frequency dependence of the if/lo bandpass (i'm ignoring the frequency dependence prior to the cal injection).
• calDif = calOn - calOff
• The various frequency dependencies of the meaurements are then:
• [ (calInK*gCal)/(calDif * gCal*gIF) ] = spcToK/gIF
• Before fitting to spcToK, we need to remove the gIF bandpass. This can be done by dividing by a normalized verion of the calOff spectra.
• [ (calInK*gCal)/({calDif * gCal*gIF}/{normalized(calOff )*gIF}) ] = spcToK
• We need to normalize the cal off spectra to unity so we don't lose the spectrometer counts.
• The normalization i've been using is to compute the median value of the caloff spectra discarding 6% of the edges (where the bandPass falls off).
• Putting it all together we get:
• y=CalInK / [ (calOn-calOff]/(normalized(calOff))]
• coef=linearFit(x,y[x])  where x excludes 6% of both sides of the bandpass
• spcToKFit=evaluatePolynomial(x,coef) using the entire range of frequency bandpass.

# Approximating the alfa Cal values: (top)

The new mock spectrometer has a maximum bandwidth of 172 MHz per frequency band. Across this large a band pass, the cal table values can vary. Some cal on, off data from project a2133 (auds) was used to investigate the cal variation with frequency.  Their setup was:
• Alfa receiver used
• Mock spectrometer with 172 MHz Bandwidth.
• 1 band centered at 1300 MHz, 1 band centered at 1450 MHz
• 3 1 second integrations with cal on followed by 3 1 second integrations with cal off.

The plots show the tabulated cal values, and the cal values measured using the calOn,calOff with these tabulated values. There is one set of plots for the 1300 MHz band and a second set for the 1450 MHz band. Each set of plots has 7 pages, one for each beam of alfa:
• cal values for the 1300 MHz alfa band (.ps) (.pdf)
• cal values for the 1450 MHz alfa band (.ps) (.pdf)
• The plots:
• Top: polA: Measured cal In kelvins and tabulated cal in Kelvins
• (Calon-calOff)/Normalized(calOff)  * countsToKelvinFit (from 2 below).
• red: the tabulated cal values
• 2nd: Cal scale factor: data and fit:
• black: calKelvins/[ (calOn-calOff)/normalized(calOff)]
• Red: linear fit to black line
• You can see that the cal ripple in the first plot gets removed when you divide the tabulated calvalue by the calon,calOff value.
• 3rd/4th same as 1,2 but for polB.
• 1300 MHz.
• The polA lowfreq part of the tabulated cal values do note match the calOn,calOff measured values very well. It may be that the measurements of the tabulated cal values done with the 3 level  wapp correlator could not handle the large radars in this part of the band. The 12 bit mock spectrometer with its polyphase filter bank does a better job. On the other hand, polB seems to have a better match between the tabulated and measured  values so go figure...
• 1400 MHz
• polB beams: 0,1,2,4,5 have a bump around 1450MHz. This is seen in the tabulated values and the calOn,off measurement.

# Summary:

• a linear fit to calK/(calDif/norm(calOff)) does a pretty good job of approximating the cal value over the entire band.
• For some of alfa's beams, using the tabulated cal value at the center of the band does just as well as the linear fit.
• For those bands that have a strong ripple in the tabulated cal value (eg  1450 beam1 polB), using the tabulated value at the center of the band (15.5 K) overestimates the average cal value for the band (about 11.5 Kelvins).
• You should remove the IF bandpass from your data prior to multiplying by the calSclFit data.
• Fitting to the cal scale factor is being implemented in the idl routines mascalonoff(). The older wapp/interim correlator routines still use the tabulated value at the center of the band.

processing: x101/090616/chkmascal.pro