; VBCAL
;---------------------------------------------------------------
;! Scale visibility amplitudes by antenna based constants
;# TASK VLBI CALIBRATION
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 2009, 2012, 2014, 2019
;;  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
;-----------------------------------------------------------------------
VBCAL     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
VBCAL     Task to multiply antenna amplitude gain factors.
INNAME                             Input UV file name (name)
INCLASS                            Input UV file name (class)
INSEQ             0.0     9999.0   Input UV file name (seq. #)
INDISK            0.0        9.0   Input UV file disk unit #
OUTNAME                            Output UV file name (name)
OUTCLASS                           Output UV file name (class)
OUTSEQ           -1.0     9999.0   Output UV file name (seq. #)
OUTDISK           0.0        9.0   Output UV file disk unit #.
APARM                              Control info.
                                   1-4 => start day,hr,min,sec
                                   5-8 => end day,hr,min,sec
                                          0's => all.
                                   9 => first ant. no. +
                                        (array no.-1)*100
                                   10 => 0=RCP, 1=LCP, 2=both.
FPARM                              antennas 1-30 factor
RPARM                              antennas 31-60 factor
VPARM                              antennas 61-90 factor
VPARM
                                   factor=SQRT(fac1*fac2)
DOWEIGHT         -1.0        1.0   > 0 => correct weights too
DOCENTER                           >= 0 -> center frequency axis
----------------------------------------------------------------
VBCAL
Type:  Task
Use:   Scale visibility amplitudes by antenna based constants.
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.
  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 w room
  APARM........Control information.
             1-4 => start day, hour, min, sec
             5-8 => end day, hour, min, sec
             9   => first antenna number plus 100*(array #-1)
                    If antenna number = 0, all baselines of the
                    specified array will be multiplied by
                    FPARM(1).  If < 0, all baselines of all
                    arrays will be multiplied by FPARM(1).
                    Use APARM(9)=1 in most cases.
             10  => 0=RCP, 1=LCP, 2=BOTH
  FPARM......1-30 are antenna factors for antennas 1-30.
             Scale factor = SQRT (fac1*fac2)
  RPARM......1-30 are antenna factors for antennas 31-60.
             Scale factor = SQRT (fac1*fac2)
  VPARM......1-30 are antenna factors for antennas 61-90.
             Scale factor = SQRT (fac1*fac2)
  DOWEIGHT...> 0 => correct weights too (normally a good idea).
  DOCENTER...>= 0 => Change frequency axis reference pixel to
                     Nchan / 2 + 1
             else => do not change reference pixel
---------------------------------------------------------------
VBCAL: Task to scale some antenna calibrations by constants.
DOCUMENTOR: R. C. Walker  NRAO/CV
RELATED PROGRAMS:  VBFIT, UVFLG, REAMP

                   PURPOSE

     VBCAL will multiply the amplitudes in a uv data set by
antenna based calibration constants.  Data to be corrected can
be selected by timerange, antenna and array.  The program is
primarily intended to be useful in calibrating VLB data, but
can be used to scale any type of data.  It can be used to
apply a global, constant scale factor to any data, for
instance, if the flux density calibration of an experiment
is found to be wrong.

                   COMMENTS

APARM:
     The desired timerange is specified with the APARM array.  The
first four elements are the start time and the next four are the stop
time, both specified as  day,hour,minute,sec.  Times are the IAT as
displayed by programs such as LISTER at the VLA.  The first day of the
experiment is day 0.  For example, to select all data in the range:
day 0, 07:30:15 to day 1, 12:34:00, specify
        APARM = 0, 7, 30, 15, 1, 12, 34, 0

     APARM(9) is used to specify the subarray and the first antenna to
be processed.  If APARM(9) <= 0, FPARM(1) is applied to all antennas.
If the uv data base contains data from more than one subarray, the
subarray number is specified with the hundreds digit which is set to
the array number minus one.  eg: if the first antenna is number 9 of
only one array,  use APARM(9)=9.  If the first antenna is number 5 of
the third array, use APARM(9)=205.  If the antenna number specified is
zero, all antennas of the specified array will be multiplied by
vPARM(1).  Note that if APARM(9)=0, all antennas of array one and only
array one will be multiplied.  If APARM(9) is less than zero, all
antennas of all arrays are multiplied by FPARM(1).

     APARM(10) is used to specify the polarization to be
scaled.  0 for RCP, 1 for LCP, and 2 for both.  For spectral
line data, all data of the requested polarization will be
processed.

     FPARM, RPARM, VPARM are used to input the scale factors for the
90 antennas beginning with the one specified in APARM.  <= 0 -> 1.0

