; VBGLU
;---------------------------------------------------------------
;! Glues together data from multiple passes thru the VLBA corr.
;# Task UV SPECTRAL VLBI
;-----------------------------------------------------------------------
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
VBGLU     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
VBGLU     Task which glues uv frequency blocks back together
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 #
IN2NAME                            Second UV file name (name)
IN2CLASS                           Second UV file name (class)
IN2SEQ            0.0     9999.0   Second UV file name (seq. #)
IN2DISK           0.0        9.0   Second UV file disk unit #
IN3NAME                            Third UV file name (name)
IN3CLASS                           Third UV file name (class)
IN3SEQ            0.0     9999.0   Third UV file name (seq. #)
IN3DISK           0.0        9.0   Third UV file disk unit #
IN4NAME                            Fourth UV file name (name)
IN4CLASS                           Fourth UV file name (class)
IN4SEQ            0.0     9999.0   Fourth UV file name (seq. #)
IN4DISK           0.0        9.0   Fourth 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 #.
----------------------------------------------------------------
VBGLU
Task:  This task is designed to deal with VLBA data that have
       been correlated in multiple passes. Multiple passes in
       the VLBA sense do not have the historical conotation
       associated with older VLBI correlators. For the VLBA all
       baselines are correlated simultaneously but only 8 IFs
       can be correlated at any one time. So the data have to
       be glued together in the spectral domain. Up to 4 input
       files can be handled simultaneously - this will deal with
       the worst case scenario (MkIII Mode A). The choice of
       input file 1 is important - it should be the file with
       the largest number of visibilities since it is the one
       used to set up the times of the data in the output file.
       See the EXPLAIN file for more details.
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.
  IN2NAME....Second file name.
  IN2CLASS...Second file class
  IN2SEQ.....Second file sequence number.
  IN2DISK....Second file sequence number.
  IN3NAME....Third file name.
  IN3CLASS...Third file class
  IN3SEQ.....Third file sequence number.
  IN3DISK....Third file sequence number.
  IN4NAME....Fourth file name.
  IN4CLASS...Fourth file class
  IN4SEQ.....Fourth file sequence number.
  IN4DISK....Fourth file sequence number.
  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 for the file.
----------------------------------------------------------------
VBGLU Glues VLBA data together IF by IF.
DOCUMENTOR: P.J.Diamond

                          PURPOSE

 VBGLU Glues together data that were correlated in multiple passes
 on the VLBA correlator, multiple pass is not used in its historical
 sense of different baselines/pass but in the sense of different
 IFs/pass. This is necessary because the VLBA correlator can only
 deal with 8 IFs at a time, but when MkIII Mode A,B or C are
 correlated the data have to be split up in frequency space.

 VBGLU is a generalization of UVGLU. What it does is read the file
 headers and FQ tables and constructs a composite header/FQ table.
 It then uses the first file given by the user as the master file and
 copies that file to output, exapnding it to the appropriate number
 of IFs. It then runs through the (up to 3) other files joining
 together spectra with the same baseline/time. If a record exists
 with no match in the master output file then it will be dropped.
 If there are records in the mastre output file with no match in the
 other input files then the empty IFs will be flagged.

 Several assumptions are implicit in this process:
 (1) Data have the same order
 (2) The source/antenna numbers are identical
 (3) There are the same number of spectral channels per IF

 VBGLU then copies those tables that have no IF dependency. It then
 takes the tables that do have arrays that depend on IF and performs
 an analagous operation to that done on the uv-data. The tables from
 the first file are taken to be the master representations and the
 others are merged with them. The tables that are bonded in this way
 are: AT,IM,CL,SN,MC,TY,PC,BP and BL.



