; UVADC
;---------------------------------------------------------------
;! Fourier transforms and corrects a model and adds to uv data.
;# TASK UV AP ANALYSIS
;-----------------------------------------------------------------------
;;  Copyright (C) 1995-1997, 1999, 2001-2002, 2008
;;  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
;-----------------------------------------------------------------------
UVADC     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
UVADC     Task to correct and add CLEAN components to uv data.
INNAME                             Input UV file name (name)
INCLASS                            Input UV file name (class)
INSEQ             0.0     9999.0   Input UV file name (seq. #)
INDISK                             Input UV file disk unit #
NMAPS             0.0     4096.0   No. maps to use for model.
CHANNEL          -1.0     9999.0   Spectral channel (0=>all)
                                   Use 0 for continuum
BIF               0.0     9999.0   First IF (0=>1)
EIF               0.0     9999.0   Highest IF (0=>BIF to last)
IN2NAME                            Cleaned map name (name)
IN2CLASS                           Cleaned map name (class)
IN2SEQ            0.0     9999.0   Cleaned map name (seq. #)
IN2DISK                            Cleaned map disk unit #
INVERS           -1.0    46655.0   CC file version #.
OUTNAME                            Output UV file name (name)
OUTCLASS                           Output UV file name (class)
OUTSEQ           -1.0     9999.0   Output UV file name (seq. #)
OUTDISK                            Output UV file disk unit #.
BCOMP                              First CLEAN comp to sub.
                                   1 per field.
NCOMP                              Last CLEAN comp to sub.
                                   to use (0 => all)
FLUX                               Lowest CC component used.
CPARM                              (1) >0 => max. correct for
                                      bandwidth smearing
                                   (2) bandwidth corr. factor
                                   (3) frequency corr. factor
FACTOR                             Factor times CLEAN fluxes.
                                   0->1.0  add
                                     -1.0  subtract
SMODEL                             Source model, 1=flux,2=x,3=y
                                   See HELP SMODEL for models.
BADDISK                            Disks to avoid for scratch
----------------------------------------------------------------
UVADC
Task:  Fourier transforms a CLEAN point model and corrects for geometric
       distortions and adds to a uv data set.  This task is designed for
       use to correct the effects of minor geometric distortions due to
       curvature of the sky and optionally (1) bandwidth smearing, (2)
       errors in the nominal bandwidth, and (3) errors in the nominal
       center frequency.  It is mostly of use for snapshots with the
       VLA.
          If a correction for bandwidth smearing is requested then the
       correction factor for each component/visibility/frequency is
       limited to the range (0.98, 1.0 + 0.01*CPARM(1))  If the computed
       correction is outside of this range then 1.0 + 0.01*CPARM(1) is
       used.  Note: this correction cannot recover badly smeared images
       and will amplify the noise on some baselines!
          If a correction is to be made to the nominal bandwidth to be
       used for the bandwidth smearing correction this can be passed as
       CPARM(2).  A similar correction to the nominal center frequency
       (and thus the u, v and w) can be passed as CPARM(3).
            Model images made with both values of IMAGR's DO3DIMAG
       option are handled correctly.

       NOTE: this task does NOT apply flagging or calibration tables
       to the input UV data.  Run SPLIT first if that operation is
       desired.
Adverbs:
  INNAME.....Input UV file name (name).    Standard defaults.
  INCLASS....Input UV file name (class).   Standard defaults.
  INSEQ......Input UV file name (seq. #).  0 => highest.
  INDISK.....Disk drive # of input UV file.0 => any.
  NMAPS......Number of image files to use for model.  If more than one
             file is to be used, the NAME, CLASS, DISK and SEQ of the
             subsequent image files will be the same as the first file
             except that the LAST 3 or 4 characters of the CLASS will
             be an increasing sequence above that in IN2CLASS.  Thus,
             if INCLASS='ICL005', classes 'ICL005' through 'ICLnnn'
             or 'ICnnnn', where nnn = 5 + NMAPS - 1 will be used.  Old
             names (in which the 4'th character is not a number) are
             also supported: the last two characters are '01' through
             'E7' for fields 2 through 512.  In old names, the highest
             field number allowed is 512; in new names it is 4096.
  CHANNEL....Frequency channel, 0 => all (use 0 for continuum)
  BIF........First IF to process. 0=>1
  EIF........Highest IF to process 0=> do BIF to highest.
             Note: not all data sets will have IFs.
  IN2NAME....Model map name (name).      Standard defaults.
  IN2CLASS...Model map name (class).     Standard defaults.
  IN2SEQ.....Model map name (seq. #).    0 => highest.
  IN2DISK....Disk drive # of model map.  0 => any.
  INVER......CC file ver. number.          0 => highest.
  OUTNAME....Output UV file name (name).   Standard defaults.
  OUTCLASS...Output UV file name (class).  Standard defaults.
  OUTSEQ.....Output UV file name (seq. #). 0 => highest unique.
  OUTDISK....Disk drive # of output UV file.  0 => highest with space
  BCOMP......The first clean component to process. One value is
             specified for each field used.
  NCOMP......Number of Clean components to use for the model, one
             value per field.  If all values are zero, then all
             components in all fields are used.  If any value is not
             zero, then abs(NCOMP(i)) (or fewer depending on FLUX and
             negativity) components are used for field i, even if
             NCOMP(i) is zero.  If any of the NCOMP is less than 0,
             then components are only used in each field i up to
             abs(NCOMP(i)), FLUX, or the first negative whichever
             comes first.  If abs(NCOMP(i)) is greater than the number
             of components in field i, the actual number is used.  For
             example
                   NCOMP = -1,0
             says to use one component from field one unless it is
             negative or < FLUX and no components from any other
             field.  This would usually not be desirable.
                   NCOMP = -1000000
             says to use all components from each field up to the
             first negative in that field.
                   NCOMP = -200 100 23 0 300 5
             says to use no more than 200 components from field 1, 100
             from field 2, 23 from field 3, 300 from field 5, 5 from
             field 6 and none from any other field.  Fewer are used if
             a negative is encountered or the components go below
             FLUX.
  FLUX.......Only components > FLUX in absolute value are used in the
             model.
  CPARM......Task enrichment parameters:
             (1) If CPARM(1) is > 0 then a correction is applied for the
                effects of bandwidth smearing.  The value of CPARM(1)
                gives the maximum correction in percent.
             (2) If CPARM(2) > 0 then CPARM(2) is a factor to be
                multiplied times the nominal (header) value of the
                bandwidth before making the bandwidth smearing
                correction.
             (3) If CPARM(3) > 0 then CPARM(3) is a factor to correct
                the reference frequency.  This will correct both the
                reference frequency and the values of, u, v and w in the
                output dataset.
  FACTOR.....This value will be multiplied times the CLEAN component
             flux densities before addition.  The default 0->1.0, so the
             clean component model  will be added from the UV data.
             FACTOR=-1 will subtract the clean component model from the
             uv data.
  SMODEL.....A single component model to be used instead of a CLEAN
             components model; if abs (SMODEL) > 0 then use of this
             model is requested.
                SMODEL(1) = flux density (Jy)
                SMODEL(2) = X offset in sky (arcsec)
                SMODEL(3) = Y offset in sky (arcsec)
                SMODEL(4) = Model type (uses point only)
  BADDISK....The disk numbers to avoid for scratch files.
----------------------------------------------------------------
