%-----------------------------------------------------------------------
%;  Copyright (C) 1995
%;  Associated Universities, Inc. Washington DC, USA.
%;
%;  This program is free software; you can redistribute it and/or
%;  modify it under the terms of the GNU General Public License as
%;  published by the Free Software Foundation; either version 2 of
%;  the License, or (at your option) any later version.
%;
%;  This program is distributed in the hope that it will be useful,
%;  but WITHOUT ANY WARRANTY; without even the implied warranty of
%;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%;  GNU General Public License for more details.
%;
%;  You should have received a copy of the GNU General Public
%;  License along with this program; if not, write to the Free
%;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
%;  MA 02139, USA.
%;
%;  Correspondence concerning AIPS should be addressed as follows:
%;         Internet email: aipsmail@nrao.edu.
%;         Postal address: AIPS Project Office
%;                         National Radio Astronomy Observatory
%;                         520 Edgemont Road
%;                         Charlottesville, VA 22903-2475 USA
%-----------------------------------------------------------------------
\documentstyle[twoside]{article}
\setlength{\topmargin}{-8mm}
\setlength{\textwidth}{160mm}
\setlength{\textheight}{225mm}
\setlength{\oddsidemargin}{0mm}
\setlength{\evensidemargin}{0mm}
\setlength{\parindent}{0em}
\setlength{\parskip}{1.5ex}
% \setlength{\mathindent}{7.8em}
% \pagestyle{plain}
\pagestyle{headings}
\raggedbottom
\bibliographystyle{plain}
%				Fonts
\newfont{\us}{cmssq8}
\newfont{\af}{cmsy10 at 12pt}
\def\tt{\fam\ttfam\tentt}

%    				Format AIPS task inputs
\def\disptt#1#2{\begin{minipage}[t]{6cm}$>$ {\us #1} \end{minipage}
                   \begin{minipage}[t]{8cm}#2 \vspace{5pt}\end{minipage}\\}
%				Long input parameters
\def\displl#1{\begin{minipage}[t]{10cm}$>$ {\us #1} \end{minipage}}
%				Tabulate tasks
\def\tabtsk#1#2{\begin{minipage}[t]{3cm}{\us #1} \end{minipage}
                   \begin{minipage}[t]{11cm}#2 \vspace{5pt}\end{minipage}\\}

%				Local definitions.
\def\kms{~km~s$^{-1}$}
\def\h20{H$_2$O}
\def\etal{$ et\ al.\ $}
\def\AIPS{{\af AIPS\/}}
%
\newcommand{\memnum}{90}
\newcommand{\whatmem}{\AIPS\ Memo \memnum}
\newcommand{\memtit}{Delay decorrelation corrections for VLBA data
      within AIPS}
% \title{Delay decorrelation corrections for VLBA data within AIPS}
\title{
%   \hphantom{Hello World} \\
   \vskip -35pt
   \fbox{{\large\whatmem}} \\
   \vskip 28pt
   \memtit \\}

\author{A. J. Kemball \\ NRAO, Socorro \\ {\it akemball@nrao.edu}
\vspace{3mm}}
%
\parskip 4mm
\linewidth 6.5in
\textwidth 6.5in                     % text width excluding margin
\textheight 8.81 in
\marginparsep 0in
\oddsidemargin .25in                 % EWG from -.25
\evensidemargin -.25in
\topmargin -.5in
\headsep 0.25in
\headheight 0.25in
\parindent 0in
\newcommand{\normalstyle}{\baselineskip 4mm \parskip 2mm \normalsize}
\newcommand{\tablestyle}{\baselineskip 2mm \parskip 1mm \small }

\begin{document}

\pagestyle{myheadings}
\thispagestyle{empty}

\newcommand{\Rheading}{\whatmem \hfill \memtit \hfill Page~~}
\newcommand{\Lheading}{~~Page \hfill \memtit \hfill \whatmem}
\markboth{\Lheading}{\Rheading}

\vskip -.5cm
\pretolerance 10000
\listparindent 0cm
\labelsep 0cm
%
%

\vskip -30pt
\maketitle
%\vskip -30pt
%\normalstyle

% \maketitle

\begin{abstract}

Recent VLBA imaging tests on DA 193 have shown the need for delay
decorrelation amplitude corrections in order to achieve images with
very high dynamic range (Cornwell, Kemball and Benson, 1995, VLBA
Scientific Memo. 11).  This memorandum describes the two major sources
of decorrelation for VLBA correlated data and how they are corrected
within AIPS.

\end{abstract}

\section{Introduction}

Data processed by the VLBA correlator may require small corrections
for two sources of baseline-based, or non-closing amplitude
errors. The first is connected with spectral pre-averaging within the
correlator and the second with mis-alignment of the FFT segments on
input to the FX correlation stage. As the need for these corrections
was revealed by high dynamic range imaging tests they were added
incrementally to AIPS, starting with the 15JAN95 release. The 15JAN95
release allowed a correction for spectral averaging losses, as
described in the associated AIPS Letter. In the 15JUL95 release the
ability to correct for the much smaller mis-alignment losses has been
added. As both sources of amplitude loss increase with larger delay
errors, they are referred to as delay decorrelation losses in what
follows.

Both are described here, along with practical information concerning
how they are applied within AIPS. Empirical measurements of these
effects are also described along with Monte Carlo simulations of the
mis-alignment losses.


\section{Delay decorrelation loss factors}
\subsection{Spectral averaging decorrelation}

The VLBA correlator may optionally pre-average cross-power data over
frequency immediately after cross-multiplication. In a typical case an
FFT size of 512 may be used and the data averaged down to 16 spectral
channels on output. Due to the presence of residual delays, averaging
over frequency introduces non-closing amplitude errors.  The amplitude
correction can only be made in subsequent post-processing once the
residual delays have been determined in fringe-fitting. For an
idealized, flat continuum spectrum with a linear phase slope, the
pre-average of $N$ points is represented by the sum:

$${{1}\over{N}} \sum_{k=0}^{N-1} e^{j(\phi_0 + \delta \omega \tau k)}
= {{1}\over{N}} {{\sin({{N \delta \omega \tau}\over{2}})} \over
{\sin({{ \delta \omega \tau}\over{2}})}} e^{\phi_0 + {{N-1}\over{2}}
\delta \omega \tau}$$


where, $\phi_0$ is the phase at the lower edge of the band, $\delta
\omega$ is the bandwidth of an individual spectral channel in the
cross-power data and $\tau$ is the residual delay across the band. The
amplitude loss factor takes the expected discrete
${{\sin(x)}\over{x}}$ form. The spectral averaging losses increase in
importance with increasing BBC filter bandwidth.

\subsection{Alignment or segmentation decorrelation}

Second-order amplitude losses are introduced in an FX correlator due
to mis-alignment of the data segments going into the FFT as a result
of residual delay errors. For an idealized, flat continuum spectrum
the amplitude loss as a function of delay is given by the
self-convolution of the weighting function used in the time domain in
the FFT. For example, for uniform weighting the delay decorrelation
function is a unit trapezoid with zeros at $\pm N_{fft}$, where
$N_{fft}$ is the FFT size in bits. Hanning weighting has been used in
the past at the VLBA correlator. The self-convolution functions for
both uniform and Hanning weighting functions are shown in Fig. 1.  It
is necessary to use the digitized correlator representation of the
weighting function in the calculation of the self-convolution and this
is implicit in what follows.

\section{Measurements of the VLBA delay decorrelation}

The delay decorrelation losses have been measured empirically using
uv-data taken as part of the DA 193 imaging tests which are reported
elsewhere (Cornwell, Kemball and Benson, 1995, VLBA Scientific
Memo. 11).  To measure the decorrelation, these data were observed
with both 8 MHz and 16 MHz BBC filters and subsequently correlated
over a range of clock offsets with both Hanning and uniform FFT
weighting. Fringe searches were used to derive a dataset with
negligible delay errors in IF 1, which was then essentially unaffected
by delay decorrelation losses. The delay decorrelation losses for
other correlation runs were then obtained by a point-by-point division
of the correlated uv-data by the data with perfect clocks and the
ratio averaged over time and frequency. Only the inner 75$\%$ of IF 1
was used in these tests. The use of non-redundant clock offsets
allowed a near uniform sampling of the decorrelation over a range of
residual delay.

The decorrelation loss factor as a function of delay is shown in
Fig. 2 for one such a test using 16 MHz data with clock errors
spanning 2000 ns and a spectral averaging factor of 16. The solid line
shows the $\sim {{\sin(x)}\over{x}}$ function describing spectral
averaging losses while the dashed line is the total amplitude loss
obtained by including alignment or segmentation decorrelation.  The
slower fall off in alignment decorrelation due to the shape of the
Hanning self-convolution function over that for uniform weighting near
zero lag is evident. Fig. 3 shows the amplitude loss factors for 8 MHz
data, again for the case of uniform and Hanning weighting and a
spectral averaging factor of 16. The solid and dashed lines describe
spectral averaging and segmentation losses respectively, as before. In
both Fig. 2 and Fig. 3 the theoretical expressions for the loss
factors are used. Residual decorrelation losses may be caused by
higher order unmodelled decorrelation or inherent limits on this type
of decorrelation measurement. The residual effects are small however
and further work on this question is in progress. It must be noted
that VLBA clock errors are typically less than 250 ns, and may be
considerably better in some cases. The range of clock errors shown in
Fig. 3 is that found for one run of the test DA 193 observations.

Returning to Fig. 2, the form of the alignment decorrelation can be
confirmed by dividing the measured total decorrelation by the
spectral averaging loss factor. The result for the 16 MHz data is
shown in Fig. 4, and is in general agreement with the expected
trapezoid and Hanning self-convolution functions for uniform and
Hanning weighting respectively. The self-convolution functions are
shown by the solid lines in each plot.

For reference, Monte Carlo simulations of a simple FX correlator were
performed, and the resulting alignment decorrelation for Hanning and
uniform weighting is shown in Fig. 5. These simulations used a flat
noise spectrum, and the functional form of the alignment decorrelation
is confirmed.

\section{Implementation within AIPS}

These corrections are not implemented in AIPS releases prior to
15JAN95.

\subsection{15JAN95}

As described in the associated AIPS Letter, this release corrects for
spectral averaging decorrelation only. This correction is activated if
the array name in the AN table is VLBA and, in addition, the AN
table contains a keyword, SPEC\_AVG, set to the spectral
averaging factor defined in Section 2.1. The correction is then made
whenever delay corrections are applied (eg. SPLIT). The spectral
averaging factor can be determined from the number of frequency
channels in the catalog header after FITLD, $N_{frq}$, and the FFT
size $N_{fft}$, which is stored in the MC table as,

$$N = {{N_{fft}} \over {2\ N_{frq}}}$$

Sample TABED input parameters required to set SPEC\_AVG are given
below:

\disptt{INNAME = file\_name}{Input uv-file name}
\disptt{INCLASS = class}{uv-file class}
\disptt{INSEQ = n}{Sequence number}
\disptt{INDISK = m}{Disk volume}
\disptt{INEXT = 'AN'}{Modify AN table keyword}
\disptt{INVERS = 1}{AN table 1}
\disptt{OUTN=INNA; OUTCL=INCL}{Set output file to input}
\disptt{OUTSEQ=INSEQ; OUTDI=INDI}{}
\disptt{OUTVERS = INVERS}{Modify AN 1}
\disptt{BCOUNT=1; ECOUNT=0}{Copy all AN entries}
\disptt{OPTYPE= 'KEY'}{Add keyword}
\disptt{APARM=0; APARM(4)=4}{Add integer keyword}
\disptt{KEYWORD = 'SPEC\_AVG'}{Keyword}
\disptt{KEYVAL = 16,0}{To set a spec. avg. factor of 16}
\disptt{KEYSTRNG=' '}{}
\disptt{TIMERANG=0}{}

\subsection{15JUL95}

This release incorporates the second order alignment decorrelation
correction in addition to the spectral averaging correction. This has
been implemented in a more general and robust framework than the
previous release by introducing a new correlation parameter frequency
(CQ) table. This table contains information about how each IF was
originally correlated and insures that such information is preserved
throughout post-processing.

FITLD will create the the CQ table under the control of the new adverb
DELCORR. If it is not created then the delay decorrelation corrections
are disabled (see Section 5).  A new task FXVLB can also be used to
create the CQ table but must be run before the frequency structure of
the uv-data file is modified by data selection or averaging (eg. UVCOP
or AVSPC). FXVLB takes only the uv-data file name as input. If the
array name in the AN table is VLBA and the CQ table is present then
the delay decorrelation corrections will be automatically made
whenever delay corrections are subsequently applied (eg. SPLIT). A
warning will be given if delay calibration is applied for VLBA data
without a CQ table. The corrections are at present intended for the
calibration of multi-source uv-data only.

The AIPS command EXPLAIN FXVLB provides further information.

\section{General notes}

\begin{itemize}
\begin{enumerate}

\item Spectral averaging in the correlator is not recommended for
spectral line projects, as these delay decorrelation corrections are
exact only for flat continuum spectra. Note however that the smaller
bandwidths typically used in spectral line observations minimize
alignment losses due to the increased time interval per bit, and
consequently the smaller fractional alignment error over the FFT size
as a whole.

\item For 16 MHz, 32 frequency channels of 500 kHz per channel
are recommended to reduce spectral averaging losses.

\item The outer frequency channels in each IF may be affected by
non-closing errors due to the assumption of flat spectral response,
and may need to be discarded for very high dynamic range imaging.

\item The differential polarization delay offset at the reference
antenna must be corrected before applying decorrelation corrections to
polarization data so that the cross-hand correlations are properly
corrected.

\end{enumerate}
\end{itemize}

\clearpage
%\pagestyle{empty}
\begin{figure}[p]
\vspace{22cm}
\special{psfile=h512.ps
 angle=-90 vscale=50 hscale=50 voffset= 600 hoffset=60 }
\special{psfile=u512.ps
 angle=-90 vscale=50 hscale=50 voffset= 300 hoffset=60 }
\caption[]{FFT weighting function (dashed line) as implemented
in the VLBA correlator for $N_{fft}$ = 512, and its self-convolution
(solid line), as a function of bit offset, for both Hanning and
Uniform weighting.}
\label{prfig1}
\end{figure}

\clearpage
%\pagestyle{empty}
\begin{figure}[p]
\vspace{22cm}
\special{psfile=hann_16.ps
 angle=-90 vscale=50 hscale=50 voffset= 600 hoffset=60 }
\special{psfile=unif_16.ps
 angle=-90 vscale=50 hscale=50 voffset= 300 hoffset=60 }
\caption[]{Measured delay decorrelation for 16 MHz data with clock
errors of 2000 ns and $N=16$. Both uniform
and Hanning weighted data are presented. The spectral averaging loss
(solid) line and total correction including the segmentation loss
(dashed line) are plotted.}
\label{prfig2}
\end{figure}


\clearpage
%\pagestyle{empty}
\begin{figure}[p]
\vspace{22cm}
\special{psfile=hann_8.ps
 angle=-90 vscale=50 hscale=50 voffset= 600 hoffset=60 }
\special{psfile=unif_8.ps
 angle=-90 vscale=50 hscale=50 voffset= 300 hoffset=60 }
\caption[]{Measured delay decorrelation for 8 MHz data with clock
errors of 270 ns and $N=16$. Both uniform
and Hanning weighted data are presented. The spectral averaging loss
(solid) line and total correction including the segmentation loss
(dashed line) are plotted.}
\label{prfig3}
\end{figure}

\clearpage
%\pagestyle{empty}
\begin{figure}[p]
\vspace{22cm}
\special{psfile=hann_16_seg.ps
 angle=-90 vscale=50 hscale=50 voffset= 600 hoffset=60 }
\special{psfile=unif_16_seg.ps
 angle=-90 vscale=50 hscale=50 voffset= 300 hoffset=60 }
\caption[]{Measured alignment or segmentation decorrelation using the
data presented in Fig. 2 corrected for spectral averaging losses. Both
uniform and Hanning weighted data are presented with the theoretical
value plotted as a solid line. Data above 800 ns are excluded due to
low SNR and outliers near the $Sinc$ null at 1000 ns.}
\label{prfig4}
\end{figure}

\clearpage
%\pagestyle{empty}
\begin{figure}[p]
\vspace{22cm}
\special{psfile=monte_hann.ps
 angle=-90 vscale=50 hscale=50 voffset= 600 hoffset=60 }
\special{psfile=monte_unif.ps
 angle=-90 vscale=50 hscale=50 voffset= 300 hoffset=60 }
\caption[]{Segmentation or alignment decorrelation for uniform and
Hanning weighted data, as obtained by Monte Carlo simulation of a
simple FX correlator with flat spectrum input noise. An FFT size of
512 bits is used here.}
\label{prfig5}
\end{figure}


\end{document}
