%-----------------------------------------------------------------------
%;  Copyright (C) 2005
%;  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[preprint]{aastex}
%
% probably don't need all these...
%
\newcommand{\AIPS}{{$\cal AIPS\/$}}
\newcommand{\POPS}{{$\cal POPS\/$}}
\newcommand{\KR}{{$\tt KRING$}}
\newcommand{\FR}{{$\tt FRING$}}
\newcommand{\SN}{{$\tt SN$}}
\newcommand{\CL}{{$\tt CL$}}
\newcommand{\ATMCA}{{$\tt ATMCA$}}
\newcommand{\ttaips}{{\tt AIPS}}
\newcommand{\DELZN}{{\tt DELZN}}
\newcommand{\AMark}{AIPSMark$^{(93)}$}
\newcommand{\AMarks}{AIPSMarks$^{(93)}$}
\newcommand{\LMark}{AIPSLoopMark$^{(93)}$}
\newcommand{\LMarks}{AIPSLoopMarks$^{(93)}$}
\newcommand{\AM}{A_m^{(93)}}
\newcommand{\ALM}{AL_m^{(93)}}
\newcommand{\eg}{{\it e.g.},}
\newcommand{\ie}{{\it i.e.},}
\newcommand{\daemon}{d\ae mon}

\newcommand{\boxit}[3]{\vbox{\hrule height#1\hbox{\vrule width#1\kern#2%
\vbox{\kern#2{#3}\kern#2}\kern#2\vrule width#1}\hrule height#1}}
%
\newcommand{\memnum}{111}
\newcommand{\whatmem}{\AIPS\ Memo \memnum}
\newcommand{\memtit}{ATMCA: Phase Referencing using more than one Calibrator}
\title{
%   \hphantom{Hello World} \\
   \vskip -35pt
%   \fbox{AIPS Memo \memnum} \\
   \fbox{{\large\whatmem}} \\
   \vskip 28pt
   \memtit \\}
\author{ Edward Fomalont\\
National Radio Astronomy Observatory\\Charlottesville, VA, USA\\
and\\
Leonid Kogan\\National Radio Astronomy Observatory\\Socorro, NM, USA\\}

%
\parskip 4mm
\linewidth 6.5in                     % was 6.5
\textwidth 6.5in                     % text width excluding margin 6.5
\textheight 8.91 in                  % was 8.81
\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
%
\vspace{5mm}

\begin{abstract}
The VLBI astrometric accuracy and image quality of a target source can
be improved if more than one reference calibrator is observed with the
target.  The improvement is obtained by determining the phase gradient
in the sky in the region of the sources, mostly caused by an
inaccuracy of the troposphere model.  Even if the target is
sufficiently strong to use self-calibration methods to determine the
image, its precise location can be improved with phase referencing.
This memo describes the scheduling strategy for multi-calibrator phase
referencing, the reduction of the data, and the use of a new
\AIPS~task \ATMCA, which combines the phase or multi-band delay
information from the several calibrators.
\end{abstract}

\section {Introduction}

    By using only one calibrator for a target source, it is assumed
that the phase observed in the direction of the calibrator is equal to
that of the target.  However, even with a calibrator-target separation
of only one degree, persistent (time-scale of one hour or more) phase
gradients above each antenna commonly occur, and these produce target
phase errors which degrade the position and image quality.  By phase
referencing with several calibrators, these phase gradient can be
estimated, hence the phase in the direction of the target can be more
accurately determined (Fomalont, 2004).  This procedure not only
removes the effect of the unmodeled component of the troposphere used
in the correlator, but that from many other effects such as the
ionospheric refraction, antenna-location errors, apriori astrometric
errors---all effects that produce a phase gradient in the sky.  The
very short term phase fluctuations of less than about five minutes in
time cover a small region of sky and cannot easily be removed using
multi-calibrators.  But these fluctuations tend to be random and
average out with no appreciable effect to the position accuracy and
image quality, apart from a slight loss of coherence.

     Recently, a new \AIPS~task, \ATMCA, has been written to combine
the data from several calibrators to improve the image quality and
position accuracy of a target source.  Another method in \AIPS, using
the task \DELZN~for determining the unmodeled component of the
troposphere, is described in AIPS memo 110 (Mioduszewski and Kogan
2004).  The observing technique adds occasional all-sky observations
of good quality calibrators, placed before and/or after the normal
phase-referencing observations, to estimate the tropospheric model
error that is then removed from observations.  This method requires
the all-sky measurements of wide spanned bandwidth in order to measure
multi-band delays, and the technique assumes that the phase or delay
error is dependent only on elevation.  The task \ATMCA~only requires
calibrator data in the vicinity of the target source; however, the
selection of calibrators and some of the processing is somewhat
different than normal phase referencing, and will be discussed in this
memo.

     This memo will be organized as follows: In \S 2 the appropriate
calibrator properties, their relative location in the sky with respect
to the target, and a cycling strategy among the sources, are
described.  In \S 3, the initial AIPS reductions will be briefly
outlined, since these differ only slightly from normal phase reference
observations which are discussed elsewhere (\AIPS Cookbook, Wrobel et
al.~2000).  In \S 4, the use of the new \AIPS~task \ATMCA~will be
described in some detail.

     We will concentrate on the use the visibility phase in the memo.
In principle, the multi-band delay can also be used, but this quantity
is normally not accurately measured in VLBA observations, particularly
those involved with phase referencing.

\section {The Choice of Calibrators}

     If you wish to calibrate an experiment that has already been
observed, then you are ``stuck'' with the calibrators already chosen,
although \ATMCA~may still be useful.  However, in designing a new
experiment, you can improve the dynamic range and astrometric accuracy
with the following guidelines.

     Lists of phase referencing calibrators are given in the VLBA
Calibrator web site {\it
http://magnolia.nrao.edu/vlba\_calib/index.html}.  Generally, each
target requires its own set of calibrators, unless several target
sources are within about five degrees of each other.  There are
several criteria for determining acceptable calibrators:
\begin{itemize}

\item Proximity of the calibrator to the target is the most important
property, other things being equal.  The length of the calibrator scan
must be sufficiently long to obtain reasonable signal to noise. As a
general rule for the VLBA, if the correlated flux density of the
calibrator is greater than 50 mJy at the longest VLBA baselines, it
can be detected in a one-minute integration.  Thus, it is better to
choose a relatively weak, but close, calibrator than one which is much
brighter but significantly farther from the target.  This is because
once you have more than 5:1 signal to noise ratio (SNR) on a
relatively weak calibrator scan, the phase error will be smaller than
the angular-dependent phase offsets caused between the target and
calibrators.

\item It is marginally better to choose a calibrator without much
angular structure and with an accurate position (Ma et al, 1998, Fey
et al, 2004).  However, as long as the candidate calibrator is
detectable at all baselines and has a position error less than 5 mas,
it is acceptable and should be considered if it is $<3^\circ$ from the
target.

\item If the target is strong and detectable in a single scan, then it
can be used as a calibrator.  This case is discussed in more detail
below.

\end{itemize}

      For many target locations, you will often find several
calibrator candidates within $4^\circ$ of the target, but search out
to $7^\circ$ if necessary.  In order to obtain the robust solutions
using \ATMCA~to determine the phase gradients, some calibrator-target
configurations are better than others.  Six examples of sky
distributions of calibrators and a target are given in
Fig.~\ref{fig1}, and each will be treated somewhat differently using
\ATMCA.

    The configurations that are recommended are: {\bf (a)} Nearly
linear disposition of two calibrators and target, or {\bf (c)} Three
calibrators surrounding the target.  Configuration {\bf (d)} s
similar to {\bf (a)} and {\bf (e)} is over-kill but is useful if one
or more of the calibrator properties is uncertain.  Configuration {\bf
(f)} can only be used with \ATMCA~if the target is sufficient strong.
More details concerning each calibrator configuration are given below.

\begin{figure}[t!]
\epsscale{0.7}
\plotone{AIPSMEM111_fig1.ps}
%%\plotone{pgplot.ps}
\vskip -0.8in
\caption{\small
{\bf Calibrator-Target Configurations:}  Six different target and
calibrator sky configurations are shown by each panel.  The symbol designations
are: {\bf T} = target; {\bf 0} = main calibrator; {\bf 1,2,3} = secondary
calibrators.  A tick-mark size of one degree roughly corresponds to the
present calibrator density.\normalsize}
\label{fig1}
\end{figure}

\begin {description}
\item {\bf (a) Two calibrators in line with the target source:} In
order to determine the phase calibration for the target, only a simple
extrapolation of the measured phase difference between calibrator {\bf
0} and {\bf 1} is needed.  The phase gradient perpendicular to the
line of sources is irrelevant.  It is slightly better if the target is
between the two calibrators.  A deviation of $45^\circ$ or less from a
straight line (as measured at the middle source) is sufficiently close
to linearity to use the straight-line interpolation between
calibrators..

\item {\bf (b) Non-linear distribution of two calibrators with
target:} The target directions to the two calibrators are nearly
perpendicular, and this will be a common occurrence.  Obviously, it is
impossible to determine the phase contribution at the target using
Calibrators {\bf 0} and {\bf 1}.  However, if we assume that the phase
gradient above each antenna is in the elevation direction (likely if
the tropospheric and ionospheric model errors are the most dominant),
we can estimate the phase contribution at {\bf T} from phase
observations of {\bf 0} and {\bf 1}, assuming the phase gradient is in
the elevation direction as shown.  If the separation of {\bf T} from
{\bf 0} and {\bf 1} is more than $3^\circ$, it is worth while adding
another calibrator, even if $5^\circ$ to $10^\circ$ away from the
target.

\item {\bf (c) Three well-placed calibrators:} The phase difference
between calibrators {\bf 0} and {\bf 1} and the phase difference
between {\bf 0} and {\bf 2} are sufficient to determine the
two-dimensional phase gradient, from which an estimate of the phase at
T can be obtained.  This configuration will give a robust solution.

\item {\bf (d) Three poorly-placed calibrators:} Calibrators {\bf 1}
and {\bf 2} are too close to give a good two-dimensional sampling of
the phase gradient.  But, the {\bf 0-2} or the {\bf 0-1} line segments
are sufficiently close to linear to revert to case {\bf a}, used twice
with the two phase slopes averaged.

\item {\bf (e) Lots of Calibrators:} Many calibrators and all of them
can be used.

\item {\bf (f) Only one calibrator:} This situation corresponds to
normal phase referencing.  If, and only if, the target source is
sufficiently strong to be detected in a few minutes of integration, it
is possible to determine the phase slope in the elevation direction.
In this case the time-scale of the elevation phase slope determination
must be relatively long, since a short time-scale solution will remove
all phase residuals of the target.  For this scheme to work, the
elevation phase slope among the antennas must not be strongly
correlated.  A similar method has been used by Brunthaler, Reid \& Falcke
(2003).

\end{description}


\section {The Observational Scheme}

    The calibrator and subsequent reduction schemes depend on the
strength of the target.  If the target is weak, then all of the
calibrators are used to determine the phase correction at the target
source.  On the other hand, if the target is strong (sometimes it is
stronger than the other calibrators), then it should be used as the
'main calibrator', with all of the other calibrators as secondaries.

\subsection {Weak Target}

     At first glance it seems that all of the observing time will be
spent on calibrators, rather than the target which needs long integration
time for good images and accurate positions.  But, in most programs
more than 50\% of the time can be allocated to the target even with
the use of several calibrators.  This is because most of the observation
time will be spent with simple phase referencing between {\bf 0} and
{\bf T}, with the suggesting switching cycle, described by Ulvestad
(1999) and Wrobel etal.~(2000).

Additional observations of calibrators {\bf 1, 2, 3} are needed at
less often than the basic {\bf 0--T} switching times since only
the persistent phase errors (say, time scales of 30 minutes or longer)
in the vicinity of the target are measured.  However, because of
short-term phase scatter, observation of a secondary calibrator every
15 minutes is recommended.

     Suggested observing schedules for a target which is too weak to be
detected are:
\vskip 0.01cm\noindent
\centerline{0--T--0--T--0--T--0--{\bf 1}--0--T--0--T--0--T--0--{\bf 1}--T--0--T...}
\vskip 0.01cm\noindent
where one out of every four {\bf T }observations is replaced by the
calibrator {\bf 1}.  For several additional calibrators, consider
\vskip 0.01cm\noindent
\centerline{0--T--0--T--0--T--0--{\bf 1--2}--0--T--0--T--0--T--0--{\bf 1--2}--0--T--0--T ...}
or
\centerline{0--T--0--T--0--T--0--{\bf 1--2}--0--{\bf 3--4}--0--T--0--T--0--T--0--{\bf 1--2}--0--{\bf 3--4}--0--T--0--T ...}
\vskip 0.01cm\noindent
    If the target source is sufficiently strong to be detected---for
observations where the accurate position of the target source is
desired---, an observing scheme is
\vskip 0.01cm\noindent
\centerline {T--0--T--1--T--2--T--3--T--0--T--1--T--2--T--3--T--0...}
\vskip 0.01cm\noindent
In this case the target is used as the main calibrator for connecting the
phase, with residual phases obtained for all of the other calibrators.

   There are two considerations in determining the length of each
scan.  First, the separation of consecutive scans of the main
calibrator (usually {\bf 0}, but {\bf T} in the last scheme above)
must be less than the coherence time.  This depends on frequency and
observing conditions and is discussed in Wrobel et al.  For
frequencies between 1.4 and 8 GHz, a maximum separation time of 5 min
is recommended, especially for the longer spacings.  At higher and
lower frequencies, a shorter time span may be needed.  Second, each
scan must be sufficiently long in order to obtain at least 5:1 snr for
each calibrator, and lengths are short as 20 sec are okay.  Use the
SCHED parameter {\tt DWELL}, rather then {\tt DUR}, to specify the
precise integration time on a scan.  For most observations, the target
can be observed nearly 50\% of the time, even when three calibrators
are used.

     Try to avoid low elevation observations as much as possible.
Generally, observations below $20^\circ$ elevation begin to show
departures from a phase-gradient in the region of the sources, and
observations below $15^\circ$ elevation should be routinely excluded.
Thus, MK and SC (BR and HN for southern sources) are not very useful
for astrometric work during the first and last hour of long tracks.

     Finally, whatever experimental frequency set-up is needed for the
target scientific goals, it should be used for all sources.  If the
target is a narrow-lined maser source, then relatively strong
calibrators may have to be chosen to be detectable in the limited
bandwidth used for the maser IF set-up.  It is also possible to choose
a maser source as one of the calibrators with the same caveat about
weak calibrators.  Of course, an accurate bandpass across the
frequency bandpass must be obtained, but this is a routine
calibration.  If there is extra time before and after the main
observation period, all-sky observations of calibrators using a
wide-spanned bandwidth can be added and analyzed using the \AIPS~task
\DELZN, before using \ATMCA.

\subsection{Strong Target}

     If the target source is relatively strong, then it can be used
as the main calibrator.  In this case, a suggested observing scheme is
\vskip 0.01cm\noindent
\centerline{0--T--1--T--2--T--3--T--0--T--1--T--2--T--3--T--0--T...}
\vskip 0.01cm\noindent so that {\bf T} becomes the main calibrator,
and {\bf 0,1,2,3} are secondary calibrators.  More comments on this
case as given below.

\section {VLBI Calibrations and Reductions}

     The reduction of the multi-calibrator data set is similar to that
for conventional phase referencing, and see the following references
for more detailed information (\AIPS~Cookbook, Appendix C, Wrobel et.\
al.\ 2000)

\subsection {Normal Phase-referencing Calibrations}

First, apply the usual apriori calibrations ({\tt ACCOR}; {\tt APCAL};
{\tt PCCOR}; {\tt TECOR}; {\tt CLCOR} with {\tt OPCODE=PANG}).  Most
of these can be conveniently done using the {\tt VLBACALA} script.
Then, run \FR~only on the main calibrator ({\bf 0} or {\bf T}), with a
solution interval over the scan.  The output \SN\ table will provides
good indication of the data quality during the experiment.  The delays
should be stable within about 5 nsec per antenna/IF, the rates should
not deviate by more the 3 mHz (except SC and MK at low elevations).
Some editing may be needed to remove outlier observations.

\begin{figure}[t!]
\epsscale{0.7}
\plotone{AIPSMEM111_fig2.ps}
\vskip -0.25in
\caption{\small{\bf Typical Phase Behavior During Experiment:} The
temporal phase behavior of the main calibrator observations for five
VLBA antennas, with reference antenna at LA, are plotted.  Each point
comes from a one minute integration and are separated by 3 min.  See
the discussion in the text.\normalsize}
\label{fig2}
\end{figure}

      A detailed inspection of the temporal phase properties of the
solution are important, since further processing will interpret small
corrections in the measured phase among several sources.  An example
of the antenna-based phase (LA was the reference antenna) for the main
calibrator after the above processing is shown in Fig.~\ref{fig2}.
The phases for BR, OV and PT are relatively stable over the day,
whereas the MK phases are very noisy (it was raining over most of the
observing time).  At the end of the time period when the SC elevation
drops below $15^\circ$, the phase rate becomes large and it is
difficult to interpolate the phase after time 1/00.7.  Although it is
possible to connect the phases, with the use of the rate, such a large
temporal phase rate guarantees a large phase gradient in the sky which
will be difficult to determine\footnote{If the phase rate is constant
over the observations, it is then a clock drift and is more safely
removed since this is a temporal effect only}.  Generally, little can
be done to improve periods of poor phase behavior.  Other indications
of poor data quality is the SNR of a solution and relatively poor
delay or rate stability of the solutions.  After any appropriate
editing and possible re-running of \FR, apply the final SN table to
the data using {\tt CLCAL} with your favorite interpolation option,
{\tt INTERPOL='CUBE'} or {\tt 'AMBG'} is recommended.

     As a precaution, now is a good time to run {\tt TASAV} in order
to save the calibration tables in order to repeat some of the
following reductions if necessary.  It is also convenient to run {\tt
SPLAT} in order to remove the intermediate {\tt SN} and {\tt CL}
tables and average overall all channels to decrease the data volume
and increase the speed of subsequent processing.

     Since most calibrators are not point sources, it is wise to image
the main calibrator )or the target source if used as the main
calibrator) with this {\tt FRING}'ed calibrated data.  One phase
self-calibration loop and then one amplitude calibration loop should
be sufficient (usually done aside and not in the main data base).
Then, with this source model, run {\tt CALIB} on the main calibrator
or target to determine the final phase and gain calibration of the
entire data set.  The resultant {\tt SN} table phases should be near
zero since the original \FR will have done a good job of calibration.
However, there will be small, systematic residual phases associated
with the deviation of the calibrator from the point source assumed in
{\tt FRING}.  The {\tt SN} table gain should be near 1.0, no more than
10\% deviations in time, between antennas and IF's.  Large excursions
indicate data that should have been flagged or have poor phase
stability within the scan.

\subsection {Removing Calibrator Position Offsets}

     The following steps are needed for the successful interpretation
of \ATMCA.  We want the phase residuals of the secondary calibrators,
as calibrated by the main calibrator, to represent the phase gradients
in the sky, but {\it NOT THEIR RELATIVE POSITION OFFSET FROM THE MAIN
CALIBRATOR}.  These offsets are associated with the slight errors in
apriori positions used in the correlation of the data.  Even when
using high quality ICRF sources (Ma et.~al.~1996; Fey et.~al.~2004),
the typical positional precision is 0.3 mas and the weaker VLBA
calibrators may have position errors somewhat larger than 1 mas.  In
principle offsets as large as 50 mas are not a problem.

     If the target is used as the main calibrator, its position may
not be well-known.  This position error will produce a large offset
position of all of the calibrators.  These offsets are, in fact, the
estimate of the target position error.

    The secondary calibrator offsets can be determined by imaging each
with {\tt IMAGR}~with the calibrated data\footnote{The calibrator
images may be significantly distorted, especially if they are more
distant than $3^\circ$ from the main calibrator.  For observations
longer than about three hours, or observations over several sessions,
the brightest point of the image is a good estimate of the correct
position.  With moderate image distortion, the centroid position is a
better position estimate.  For observations with less than three
hours, there is a strong correlation between the source offset and
atmospheric errors, so that the location of the image peak can be in
error by more than 1 mas.  In this case additional observations to tie
the secondary calibrator positions to that of the main calibrator must
be done with additional observations}.  Measure the offset position of
each secondary calibrator from the phase center; with $x$ positive to
the east and $y$ positive to the north, in arcseconds.  Then, run {\tt
CLCOR} with {\tt SOURCE = '1'; OPCODE = 'ANTC'; GAINVER = (last CL\#),
GAINUSE = (last CL\#+1), CLCORPRM=0,0,0,0,x1,y1} (don't ask).  Then
run {\tt CLCOR} again with {\tt SOURCE='2', GAINVER=(last CL\#+1),
GAINUSE=(last CL\#+1), CLCORPRM=0,0,0,0,x2,y2}; etc.  For the
hard-core astrometrists, these applications of {\tt CLCOR} also update
the {\tt SU} table containing the source positions and the appropriate
columns of the {\tt CL} for the correlation model.  Hence, the
\AIPS~astrometric tables are updated as if the correlator had actually
processed the data at the revised positions.  After making the {\tt
CLCOR} position corrections, re-image the calibrators to make sure
that they are indeed at the phase center, generally within 0.1 mas.

     Finally, run {\tt CALIB}~on the visibility data on {\it all} of
the calibrators.  This step generates the {\tt SN} table which
contains the residual antenna-based phases associated with the
calibrators; zero for the main calibrator (of course) and the
instrumental phase errors at the location of the secondary calibrator.
This is the main input to \ATMCA.  If a clean model for any of the
calibrators is used, then {\tt CALIB}~must be run on each source
separately, but with the same output {\tt SN} table.

\subsection {Reduction Summary}
     You are now ready to use {\ATMCA.  But first, a re-listing of the
previous reduction steps.
\begin {itemize}

\item Apply the usual apriori gain and phase calibrations and use the
VLBA log for appropriate editing.

\item Run \FR~on the main calibrator {\bf 0} or target {\bf T} and
check for reasonable solutions.  Interpolate the calibrations in the
{\tt SN} table using {\tt CLCAL}.

\item (optional) Run {\tt SPLAT}~to obtain a data base with the channels
averaged.  This will speed up subsequent reductions.

\item Self-calibrate on the main calibrator in the usual manner with the
last {\tt CALIB} producing the final gain and phase calibrations which
are interpolated to the entire data set.

\item Image all of the calibrators (if necessary) and the target (if
sufficiently strong)..

\item Measure the offsets of the secondary calibrators from the phase
center, and use {\tt CLCOR}~to move them to the phase center.

\item Run {\tt CALIB}~on {\it all} of the calibrators (with models if
you believe them) to produce an {\tt SN} table with the residual
phases for all calibrators.

\end {itemize}

\section {Using the \AIPS~task \ATMCA}

    The input to \ATMCA~is, thus, an {\tt SN}~table containing the
time-variable residual antenna-based phases, sampled in the direction
to the calibrators.  The phase zero is defined by the main calibrator
or target, if strong.  The goal of \ATMCA~is to determine the phase
gradient in the sky which is consistent with the phases sampled by the
secondary calibrators, and then to apply this gradient to the phase of
all sources.

\subsection {Running \ATMCA}

    The most important \ATMCA~parameters are:
\begin {itemize}
\item {\tt SNVER}: The {\tt SN}~table version which contains the
residual antenna-based phases for all calibrators.  Look at the phases
with {\tt SNPLT}~to make sure that for the additional calibrators the
phases are reasonably continuous with time (the main calibrator should
have zero phase).  There will be a noise component, mainly produced by
short term tropospheric effects, but it should not dominate over the
systematic phase drifts with time.  If it does, then \ATMCA~will not
produce very useful results.  Obvious outliers should be removed.
\ATMCA~will be able to interpret the occasional phase ambiguities
of integer multiples of $360^\circ$.  Determine the appropriate
solution interval time which seems realistic from the density of
source observations and the random noise component.  This period
should include at least one and probably two scans of the additional
calibrators, and is typically 30 to 60 minutes in length (see {\tt
SOLINT}~below).

\item {\tt GAINVER}: The {\tt CL}~table which was used by {\tt CALIB}
to generate the {\tt SNVER}~table of residual phases.  \ATMCA~copies
the {\tt GAINVER} {\tt CL} table to a version one larger than the
highest {\tt CL} table version and applies the correction for the
phase gradient to it.  The production of this new {\tt CL} table is
controlled by {\tt APARM(2)}.

\item {\tt APARM(1)}: This is most important control of \ATMCA~ since
it designates the algorithm to be used to correct the phase.  The
calibrator/target configuration will determine which of the options is
most useful, although two options are sometimes possible.

   \begin {itemize}
   \item {\tt APARM(1)} = 1, Linear Phase Interpolation Between
Calibrators: The alignment of the calibrators and target are within
$45^\circ$ of linearity, so the phase difference between the
calibrators can be interpolated to the target source.
Cases (a) and (d) in Fig.~\ref{fig1} are configurations which should use
this option.
   \item {\tt APARM(1)} = 2, Phase Slope and Orientation: The
alignment of the calibrators and target has two-dimensional coverage
so that the phase slope and orientation can be determined; cases (c)
and (e) in Fig.~\ref{fig1}.
   \item {\tt APARM(1)} = 5, Phase/Elevation: The phase slope is
assumed to be in the elevation direction over each antenna.  This
algorithm must be used in case (b) (angle between calibrators is too
large for {\tt APARM(1)}=1), but can be used for cases (c) and (e)
also.
   \item Case f: If only one calibrator has been used, and the target
source is detectable, then it is possible to determine a long-term
phase/elevation dependent using {\tt APARM(1)}=5.  For example, use
the calibrator as the phase reference source.  Then, image the target
source and move its position to the image peak in order to remove the
target position-error phase terms.  The remaining antenna-based phase
errors are associated with the angular-dependent phase error between
the calibrator and the target.  The use of \ATMCA~with {\tt
APARM(1)}=5 then determines a phase gradient in the elevation
direction for each antenna that removes the phase residual for the
target.  The solution interval must be long so that there is
sufficient parallactic angle rotation, so that the elevation
difference between the target and calibrator changes significantly.
It is recommended to use only one solution interval over the entire
observation period.
    \end{itemize}

   The use of {\tt APARM(4) = 5} is not recommended at the present
time.

\item {\tt APARM(2)}: {\tt APARM(2) = 1}~will create the output {\tt
CL}~table after correction of the phases for all sources designated in
{\tt SOURCE}, see below.

\item {\tt APARM(3)}: {\tt APARM(3) = 1} will create the output SN table which incorporates the
corrections by \ATMCA.  It can be used with {\tt SNPLT} to check on the
residuals.  Do not use this {\tt SN} for further corrections: it is used
for display only.  Using the output {\tt CL} table to re-image the calibrators
and target is also useful for checking on the corrections.

\item {\tt APARM(4)}:  {\tt APARM(4) = 0} for most cases

\item {\tt APARM(5)}:  The phases for some calibrators in the {\tt SN} table
may go over the $\pm 180^\circ$ cut.  It is crucial for \ATMCA~to recognize
lobe ambiguities.  Generally, there is a time for which there are no
phase ambiguities for all of the sources (often near the center of the
time range when the sources are at the highest elevation), and this is the
time that should be inserted.  {\tt APARM(5)}=DD.DD where DD.DD is the
time in days where the phases for all antennas and sources have no
phase ambiguity.

\item {\tt APARM(6)}: It is sometimes useful to see the revised {\tt
SN} table after application of phase ambiguities.  For {\tt
APARM(6)}=0, do not make this table.  For {\tt APARM(6)} = 1, two
.{\tt SN} tables are made.  The first table contains the original
input phases with the lobe ambiguities taken into consideration.
These phases can be plotted using {\tt SNPLT} with {\tt OPCODE =
'REAL'}.  The second SN table is the residual phase after correction
by \ATMCA.  These should be near zero.

\item {\tt SOURCES}: Which sources to apply the \ATMCA~solution.  This
can usually be kept blank which means that the \ATMCA~corrections are
applied to all calibrators and targets.

\item {\tt CALSOUR}: The first {\tt CALSOUR}~must be the main phase
calibrator.  The other calibrators should then be listed.  A strong
target source which has been used as the main calibrator should be
listed first.  Do not use {\tt CALSOUR = ''} since the main calibrator
must be the first source in the list.

\item {\tt BIF; EIF}:  Only one IF is needed for \ATMCA,
but if {\tt BIF} $\neq$ {\tt EIF}, then the {\tt SN} table inputs are averaged
over IF's before making a solution.

\item {\tt SOLINT}: The solution time interval in minutes is a
relatively important parameter.  The minimum solution time interval
should contain at least one observation scan of each calibrator.  To
average out the random phase fluctuations which are associated with
short-term tropospheric and ionospheric fluctuations, we recommend a
solution time interval which contains at least two observations of
each calibrator.  However, you can fiddle with this parameter and see
what gives the best target image.

\item {\tt OPTYPE}:  This should be kept blank or set to {\tt PHAS}.
\ATMCA~can be used with the multi-band delay, but this quantity is
not normally measured sufficiently accurately in most phase-referencing
experiments.
\end{itemize}

\begin{figure}[t!]
\epsscale{0.9}
\vskip -2.4in
\plotone{AIPSMEM111_fig3.ps}
\vskip -2.3in
\caption{\small{\bf Calibrator and Target Phases Before and After
ATMCA:} The left-hand plot shows the residual phases for the
calibrators and target that was input to \ATMCA.  The right-hand plot
show the \ATMCA~corrected phases for the calibrators and target.  The
source configuration was similar to case {\bf }c (Fig.~\ref{fig1}).
The red points are for the main calibrator {\bf 0}; the yellow crosses
are for calibrator {\bf 1}; the light blue crosses as for calibrator
{\bf 2}; the small blue points are for the target {\bf T}~which was
strong enough to be detected, but not used in |ATMCA.\normalsize}
\label{fig3}
\end{figure}

\subsection {Has \ATMCA~Worked?}

     The main way of determining if \ATMCA~has worked is to compare
the antenna-based phases shown in Fig.~\ref{fig3}.  The plot on the
left shown the calibrator antenna-based phases that were input to
\ATMCA.  The plot on the right,obtained by running {\tt CALIB} on the
output {\tt CL} table and using {\tt SNPLT} should show that most of
the phases are near zero.  Look for periods of poor phase stability or
problems with lobe ambiguities.  Low elevation observations will often
show deviations.  The {\tt SOLINT} parameter may need modification.

\begin{figure}[t!]
\epsscale{0.7}
\vskip -2.0in
\plotone{AIPSMEM111_fig4.ps}
\vskip -2.00in
\caption{\small{\bf Target Source Image Before and After ATMCA:}
(left) The image of the target source using normal phase
referencing. The peak flux density is 25.9 mJy and the maximum side
lobe is 1.7 mJy.  (right) The image of the target source using a
calibrator configuration similar to that in case c (see
Fig.~\ref{fig1}).  The peak flux density is 27.5 mJy and the maximum
side lobe level is 0.7 mJy.  The contour levels are at 0.6, 1.2, 2.4,
4.8, 9.6 mJy/beam for both images.\normalsize}
\label{fig4}
\end{figure}

     Next, image all of the calibrators and the target and see if the
image quality has improved after using \ATMCA.  A good example of the
target image improvement is shown in Fig.~\ref{fig4}, associated with
the same experiment associated in Fig.~\ref{fig3}.  The original
persistent phase errors, while only slightly decreasing the peak flux
density of the source, scatter emission into relatively large
sidelobes near the image peak.  After application of \ATMCA~the image
quality has significantly improved, with the peak sidelobe level
decreasing to 40\% of its original value, and the peak flux density
increasing by about 10\%.  The rms error of the position of the peak
has decreased from 0.1 to 0.03 mas (Fomalont \& Kopeikin 2003).

\subsection {Summary}

    Phase referencing is now used for about half of the VLBA
experiments.  Uncertainties in the tropospheric and ionospheric delays
over all of the antennas produce phase errors which erodes the quality
of the images and the position accuracy of a target source.  Until
better modeling or measurement of these delay components are
available, multi-source phase referencing can remove a major part of
this error.  The overhead of less than 25\% in the observing time to
include one or more additional calibrators near the target can
increase in the image quality and astrometric precision by more than a
factor of two.

    We thank Lorent Sjowerman and Amy Mioduszewski for many comments
and improvement to this memo.

\section{References}

\begin{description}
\item []The \AIPS\ Cookbook, Chapter 9 and/or Appendix C.

\item []Brunthaler, A., Reid, M.J. \& Falcke, H., 2003, {\it astro-ph/0309575}
\item []Chatterjee, S., 1999, {\it How accurate is phase referencing at
L-Band, An assessment}, VLBA Scientific Memo 18
\item []Fomalont, E.B., 2004, Phase Referencing Using More than One
Calibrator, in ASP Conference Series, Future Direction in High
Resolution Astronomy: Celebration of the 10th Anniversary of the VLBA.
\item []Fey, A.~L, Ma, C., Arias, E.~F., Charlot, P., Feissel-Vernier, M.,
Gontier, A.-M.,, Jacobs, C.~S., Li, J. and MacMillan, D.~S., 204
ApJ, 127, 3587
\item []Ma, C., Arias, E.F., Eubanks, T.M., Fey, A.L., Gontier, A.-M.,
Jacobs, C.S., Sovers, O.J., Archinal, B.A. \& Charlot, P.~1998, AJ,
116, 546
\item []Mioduszewski, Amy \& Kogan, Leonid 2004, AIPS Memo 110
\item []Ulvestad, J., 1999, {\it Phase-Referencing Cycle Times},
VLBA Scientific Memo 20
\item []Wrobel, J.M., Walker, R.C. \& Benson, J.M., 2000, {\it Strategies for
Phase Referencing with the VLBA}, VLBA Scientific Memo 20
\end{description}

\end {document}


