; VLBAAMP
;---------------------------------------------------------------
;! applies a-priori amplitude corrections to VLBA data
;# PROCEDURE VLBI UTILITY CALIBRATION
;-----------------------------------------------------------------------
;;  Copyright (C) 2015
;;  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
;-----------------------------------------------------------------------
VLBAAMP   LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
VLBAAMP:  Applies a-priori amplitude corrections
INNAME                             Input file name
INCLASS                            Input file class
INSEQ                              Input file sequence number
INDISK                             Disk number for input file
SUBARRAY                           Subarray to correct. 0=>ALL
DOFIT                              Fit for opacity correction
BADDISK                            Disks to avoid for scratch

          VLBAAMP is defined in the VLBAUTIL run file.
----------------------------------------------------------------
VLBAAMP
Type: Procedure
Use:  VLBAAMP is a procedure that applies post-bandpass and delay
      calibration amplitude correction and a-priori amplitude corrections.
      These corrections are added to the corrections in the highest
      numbered CL table.

      VLBAAMP assumes that you already have GC and TY tables and that you
      have at least one CL table.

      Type RUN VLBAUTIL to define the VLBAAMP procedure.

  INNAME.....The name of the file to be corrected. Wildcard characters are
             allowed.
  INCLASS....The class of the file to be corrected. Wildcard characters are
             allowed.
  INSEQ......The sequence number of the file to be corrected. Zero defaults
             to the highest sequence number of a file matching INNAME,
             INCLASS, and INDISK.
  INDISK.....The disk drive number of the file to be corrected. Zero defaults
             to any disk.
  SUBARRAY...The subarray to correct. Zero defaults to doing all.
  DOFIT......Do opacity correction in APCAL.  This is recommended
             for high frequency experiments (freq >= 15~GHz) if the
             accuray of the source flux is important.
  BADDISK....A list of disks on which scratch files are not to
             be placed.  This will not affect the output file.
----------------------------------------------------------------
VLBAAMP:            Procedure to apply a-priori amplitude corrections
Documentor:         Amy Mioduszewski
Related Programs:   VLBAUTIL, ACSCL, SNSMO, APCAL, CLCAL

VLBAAMP determines the post-bandpass and delay calibration amplitude
correction and a-priori amplitude corrections from the gain curves and
system temperature measurements, and applies these corrections to the
highest numbered calibration (CL) table attached to the input file.
Note that interpolation type 'SELF' is used for the a-priori amplitude
calibration, to avoid interpolating between sources at different
elevations, among other things.

You should run VLBAAMP after loading any gain curves or system temperature
data for non-VLBA antennas using ANTAB.

VLBAAMP should be used along with (and after) VLBAACOR and VLBAPASS instead
of VLBACALA.  This redesign of the amplitude calibration path is based on
VLBA Scientific Memo #37 (Craig Walker).  VLBAAMP should NEVER be used with
VLBACALA.  The new recommended steps for amplitude calibration are:
  1) Do preliminary calibration steps that are necessary (e.g., VLBAFIX,
      VLBAEOPS, VLBATECR...).
  2) VLBACCOR -- digital sampling corrections
  3) VLBAMPCL (or VLBAPCOR) -- remove instrumental delay
  4) VLBABPSS -- do bandpass
  5) VLBAAMP -- correct auto-correlations and a priori amplitude calibration
  6) Continue with calibration.

