Recently, we noticed a serious issue of the Class "fold" command: it assumes that the so-called bandpass ghosts which occur when using frequency switching (see below) have the same amplitude as the (positive) emission lines. Unfortunately, this is wrong if the line intensity is not much smaller than the system temperature, e.g. for masers or HI observations of the Milky Way disk.

We worked on a workaround, which is to not only calculate (Sig-Ref)/Ref and apply the class fold command, but by also computing (Ref-Sig)/Sig and shift-and-add both representations.

### About Bandpass Ghosts

First of all it is important to note, that in frequency switching the amplitude of the "ghost lines" is never an estimate of the line flux! Why?

Consider the equation

T=Tsys * (Psig-Pref) / Pref

which is the basic equation to be applied. As in (in-band) frequency shifting the emission lines is also present in Pref, one will not only divide the signal spectrum Psig by the bandpass shape, but at the frequency where the emission line is located in the reference phase, one will divide by the bandpass curve plus line intensity. This causes so-called /bandpass ghosts/ in the reduced spectra.

As one can derive from the equation, the amplitude of the ghost is dependent on the source flux! A trivial example: assume a raw spectrum having a constant baseline level (which is bandpass times continuum flux) of 10 counts. The spectral line shall have 5 counts. The emission line will have a flux of (15-10)/10=0.5*Tsys. The ghost will have a flux of (10-15)/15=-0.33*Tsys which is not -1/2 but -2/3 of the expected emission! Assume now a source flux of 90 counts. Emission has (90-10)/10=9*Tsys. The ghost will have (10-90)/100=-0.8*Tsys. Very, very differentâ€¦ Even worse, the shape of the ghost lines is also distorted with respect to the emission line (see Figure below)

Figure: In order to show the effect of asymmetric bandpass ghosts we use a simple model: different source intensities (Tsou=5, 10, 20, 50, and 100 K) were put on a hypothetical system temperature, Tsys=100 K. The bandpass was assumed to be flat (without loss of generality). For visualization purposes the spectral lines are triangular-shaped. The larger the input source temperature gets with respect to Tsys the smaller the line ratios. Also the distortion gets more and more pronounced.

### Comparison between old and new method

To compare the old method and our new approach we reduced one observation of the HI source S7 (a spot in one of the Milky Way spiral arms).

The first figure shows how the reduced spectra would look like with the old reduction method \before\ applying the CLASS "fold" command.

As can be seen, the amplitude of the ghost is much smaller than the emission line intensity. Applying the "fold" command results in the following spectrum:

As CLASS does only an flipping of the spectrum (T â†’ -T) and shift-adding, the resulting spectrum is clearly wrong in terms of intensity calibration. Furthermore, the bandpass ghost in the right part has a different amplitude than the one in the left.

Finally, we show the result using the new approach:

As can be seen, the intensity of the emission line is the same as in the unfolded spectrum. Also, the two ghosts have similar amplitudes and shape (but of course they can still not be used to infer the true line intensity!). We also computed the baseline RMS for each of the cases. Not surprisingly, the old method folded and the new method have smaller RMS (by a factor sqrt(2)), because all four phases are taken into account.

### Comparison between new method and position switching

Finally, we compare the new frequency switching reduction algorithm to results obtained with position switching. One major issue of the new frequency switching procedure is, that the Effelsberg Class Pipeline has to regrid (shift) the spectra, while in the old version CLASS would do the shifting. We make use of an FFT-based regrid Algorithm, which was carefully tested and also provides the correctly shifted spectrum if the shift (in spectral channels) is not an integer number.

The plot below shows reduced spectra of a measurement of H2O Maser lines (W3OH) using position and frequency switching. The LO shift frequency was chosen to 1.11 MHz (181.8624 spectral channels) to specifically test the regrid procedure with non-integer shifts. Both spectra match very well:

The new "calibration scheme" is already in place in the the automatic pipeline. No further fold is needed in class. Nevertheless it is possible in the offline pipeline to reduce a scan in the old way and fill it to class using the command:

**reduceSubscan(scan, subscan,fswFold=False)**

Default is fswFold=True !