Produced by IDL 7.1.1
User Documentation

./toolbox
dcfold.pro

Last modification date:
Wed Sep 28 13:27:10 2016

dcfold

function dcfold(sig, ref, [ftol=double], [/blankinterp], [/nomask])

Average two parts of in-band frequency switching (signal and reference phases, with the cal-switching phases already calibrated). Typically this happens after getfs. It does not matter which data container containers which part since their relative distance in frequency is used to determine how one is shifted to align with the other. The returned result is a new data container that the user must eventually free using data_free in order to avoid any memory leaks. sig and ref must have the same number of channels and the same spacing between channels. If sig and ref are already aligned, then this is a simple average (a warning message will be printed). If the shift necessary to align ref with sig is more than the total number of channels, there is no overlap and this procedure will print an error message and return without altering sig and ref.

The "ref" data container is shifted to align in sky frequency with the "sig" data container using dcshift and the two data containers are averaged - weighting each by the inverse of square of their system temperatures. The system temperature in the result is the weighted average of the two system temperatures.

If there are any blanked channels in either "sig" or "ref" then the corresponding channels in the other spectrum, after "ref" has been shifted to align in sky frequency with "sig", are also blanked so that the average at those channels is blanked. This is done to avoid the appearance of a spike at a blanked channel where the contribution from the other spectrum, after the shift, is typically not blanked and not equal to the local average of surrounding, non-blanked, channels. This behavior can be turned off by the nomask keyword. Alternatively, all blanked channels in "sig" and "ref" can be replaced using a linear interpolation from adjacent non-blanked channels (a simple average in the case of single, isolated, blanked channels) using the blankinterp keyword.

Returns
data container. The user is responsible for freeing this. returns -1 on error.
Uses
dcshift dcinterp data_free data_valid
Version
$Id$

Parameters
sig
in/out, required
variable
The data container to use as the signal part in the average.
ref
in/out, required
variable
The data container to use as the reference part in the average. This data is shifted using dcshift to align with "sig" before averaging.

Keywords
ftol
in, optional
double (def. 0.005)
The fractional channel shift tolerance. If the fractional part of the channel shift necessary to align the two parts is less than this value, no fractional shift as described in the documentatio for dcshift will be done. It might be useful to turn off the fractional shift because it can cause aliases and ringing in the case of very strong lines or other sharp features. If ftol > 0.5 no fractional shifts will be done.
blankinterp
in, optional
boolean
When set, blanks are replaced before shifting and averaging by a linear interpolation using the finite values found in the two spectra. The dcinterp procedure is used. For single blanked channels, the replacement value is the average of the two adjacent channel values.
nomask
in, optional
boolean
When set, turn off the masking of blank channels from each spectrum on to the other, after the shift. This may result in spikes at the location of blanked channels. This was the original behavior of this routine. This keyword has no effect if blankinterp is set.


Produced by IDLdoc 1.6 on Wed Sep 28 13:27:38 2016