; AVSPC
;---------------------------------------------------------------
;! Averages uv-data in the frequency domain
;# Task UV Spectral
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 2000-2001
;;  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
;-----------------------------------------------------------------------
AVSPC     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
AVSPC     Task to average uv data in frequency.
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 #.
ICHANSEL                           Array of start and stop chn
                                   numbers, plus a channel
                                   increment and IF to be used
                                   for channel selection in the
                                   averaging. See HELP ICHANSEL.
                                   Default = center 75% of band.
AVOPTION                           Averaging option '  ','AVIF',
                                   'SUBS'
BIF               0.0      100.0   Lowest IF number (AVIF only)
EIF               0.0      100.0   Highest IF number (AVIF only)
FLAGVER                            Flag table version
CHANNEL                            # chans to average together
                                   used when AVOPTION = 'SUBS'
----------------------------------------------------------------
AVSPC
Task:  Average a  uv database in the frequency domain.
The two principle uses of this task are to create a data base
containing 'continuum' channels for use in calibrating spectral
line observations and for averaging in frequency for continuum
observations that don't require frequency resolution to reduce
bandwidth smearing.
   For the purpose of forming a continuum data base from
spectral line observations AVSPC has optional channel selection
so channels may be omitted from the average if necessary.  The
default channel range that is averaged is the center 75%, this
is what is used at the VLA to produce 'channel 0'.
   Averaging in IF as well as frequency is specified by
AVOPTION='AVIF'.  This should only be applied to previously
calibrated data.  This option is useful for continuum
observations of relatively small fields of view where averaging
in frequency and IF is desired to reduce the bulk of the data or
for display purposes.
   All tables associated with the input data are copied to the
averaged output data, however only the FG (flagging) table may
be applied.  The FG table is not copied since it has been
applied and contains channel numbers which are no longer
correct.

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 with
             space for the file.
  ICHANSEL...Array of start and stop channels plus a channel
             increment and IF, used to select the channels to be
             averaged.  For instance, if you wished to exclude
             channels 1 - 10 and 121 - 128 because of bandpass
             effects, and channels 56 - 80 of IF 1 but not IF 2
             because of interference, then you would set ICHANSEL =
             11,55,1,1, 81,121,1,1, 11,121,1,2.  If you only wished to
             use every other channel from the second IF then you would
             set ICHANSEL = 11,55,1,1, 81,121,1,1, 11,121,2,2.  Up to
             20 groups of start, stop and increment channel numbers
             plus IF numbers can be specified. The default (ICHANSEL =
             0) is to average the center 75% of the band, i.e.
             ICHANSEL(1,1) = (# channels)/8
             ICHANSEL(2,1) = (# channels + 1)*7/8
             ICHANSEL(3,1) = 1
             ICHANSEL(4,1) = 0 (meaning all IFs).
  AVOPTION...The averaging option.
             '    ' means only average frequency channels for each IF
                separately.
             'AVIF' means average BIF to EIF and write a single output
                IF.  This option is most useful for averaging multi_IF
                continuum observations of a relatively small field of
                view.
             'SUBS' means average every n channels of each IF together
                producing an output file of spectral size
                INT(input/n). Any excess channels from the input
                spectrum will be discarded. The number of channels to
                average together is specified by CHANNEL. E.g.
                AVOPTION = 'SUBS', CHANNEL = 8 on a 128 channel input
                file will produce 16 channels in the output file. The
                CHANSEL adverb is ignored when AVOPTION = 'SUBS'  A
                boxcar average will be done of those channels to be
                averaged together.
  BIF........First IF to consider. 0=>all.  Used only by AVIF option.
  EIF........Highest IF to consider. 0=>all higher than BIF.  Only
             used for AVOPTION='AVIF'
  FLAGVER....specifies the version of the flagging table to be
             applied. 0 => highest numbered table.
             <0 => no flagging to be applied.
  CHANNEL....The number of channels/IF to average together when
             AVOPTION = 'SUBS'.
             i.e., channel = # input channels / # output channels
----------------------------------------------------------------
