; VBCAL
;---------------------------------------------------------------
;! Scale visibility amplitudes by antenna based constants
;# TASK VLBI CALIBRATION
;-----------------------------------------------------------------------
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
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.
BPARM                              1-10 ant. factors
                                   factor=SQRT(fac1*fac2)
----------------------------------------------------------------
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 .eq. 0, all antennas of
                    the specified array will be multiplied by
                    BPARM(1).  If .lt. 0, all antennas of all
                    arrays will be multiplied by BPARM(1).
             10  => 0=RCP, 1=LCP, 2=BOTH
  BPARM......1-10 are antenna factors.  Factor =SQRT(fac1*fac2)
---------------------------------------------------------------
VBCAL: Task to scale some antenna calibrations by constants.
DOCUMENTOR: R. C. Walker  NRAO/CV
RELATED PROGRAMS:  VBFIT,UVFLG

                   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  BPARM=0,7,30,15,1,12,34,00

     APARM(9) is used to specify the first antenna to be
processed.  If the uv data base contains
data from more than one array, the array 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 BPARM(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
BPARM(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.

     BPARM is used to input the scale factors for the 10
antennas beginning with the one specified in APARM.
A value of 0 is replaced by 1.0.


EXECUTION TIMES:
     100,000 Visibility records can be processed in about
60 seconds of cpu time.  In an empty machine, the program
only seems to be able to use about 50% of the available
cpu so the run time will be at least twice the cpu time.
