; AVER
;---------------------------------------------------------------
;! Averages over time UV data sets in 'BT' order
;# Task UV
;-----------------------------------------------------------------------
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
AVER      LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
AVER      Task to average 'BT' sorted 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            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 #.
YINC              0.0     99999.   Averaging time (sec).
----------------------------------------------------------------
AVER
Task: This task will average a 'BT' sorted uv data set in time.
Adverbs:
  INNAME.....Input UV file name (name). Sort must be 'BT'.
             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. #).  Standard defaults.
  OUTDISK....Disk drive # of output UV file. 0 => highest with
             space for the file.
  YINC.......Averaging time (sec).   < 10.  -> 10.
---------------------------------------------------------------
AVER:  Task to average 'BT' sorted UV data
DOCUMENTOR: R. C. Walker  NRAO/CV
RELATED PROGRAMS:  UVSRT

                   PURPOSE

     AVER averages 'BT' sorted uv data bases.  It is especially
useful if a large data base can be reduced in size to make it
more manageable.  Care should be taken that the average time is
not so long that 'time average smearing' occurs - ie. that the
longer baselines sweep through enough uv space in an
integration interval to smear significant structure.
     AVER is often used after VBFIT on VLBI data.  Longer
averages are allowed at that point because relatively high
residual fringe rates due to atmosphere etc have been removed.
     AVER marks the data with a time that is the weighted
average time of the data.  For most purposes, this is proper,
but it can cause trouble when VLBI data is transfered to the
Caltech package. The times for data points corresponding to the
same average interval are not the same so they are treated as
separate points by TOCIT.  This does not work well in the
Caltech format.  To avoid the problem, the data can be averaged
in the Caltech package or AVER output can be run through the
Caltech averaging program with the same average time that was
used in AVER.  The records should be properly combined in this
way.

                   COMMENTS

YINC:
     This sets the averaging time in seconds.

SORT ORDER:
     The input data base must be in 'BT' sort order.  This is
not the same sort order of the UV data that is generally read
into AIPS (it is 'TB') and UVSRT must be run before using AVER.

EXECUTION TIMES:
     The run time on an otherwise empty VAX 11-70 is

                 1.0 * (D / 100,000) minutes

where D is the number of input UV points.
