; VLBAIT
;---------------------------------------------------------------
;! Procedure to read and process VLBA data
;# PROCEDURE VLBI
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 2007-2008, 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
;-----------------------------------------------------------------------
VLBAIT  LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
VLBAIT:  Procedure for reading and processing VLBA data
                                   ===== GLOBAL INFORMATION ==
DOTKPL                             If = 0 will send plots to
                                   printer via LWPLA
                                   If = 1 will use TEK window
DOZAP                              If = 1 will zap the SPLIT
                                   and AVSPC files after VPLOT
                                   has been run.
VLBSOU                             Source to process, must be
                                   specified
                                   ===== VLBA FITS FILE ======
NOREAD                             If > 0 will read not read
                                   the fits file
DATAIN                             Disc file name
OUTNAME                            File name (name)
OUTCLASS                           File name (class)
OUTSEQ           -1.0    9999.0    File name (seq. #)
                                      0 => highest unique number
                                     -1 => FITS tape value
OUTDISK           0.0       9.0    Disk drive # (0 => any)
                                   ===== CL GENERATION =======
GENCL                              If > 1 then will generate
                                   a CL table
                                   ===== Plot raw data =====
PLOTRAW                            If > 0 will plot the raw
                                   amplitudes & phases
                                   ===== Plot TP spectra =====
PLOTTP                             If > 1 will plot total power
                                   spectra
                                   ===== Do fringe fitting ===
DOFRNG                             If > 1 will do fringe-fitting
FRNGANT                            Reference antenna for fitting
FRINGINT                           Solution interval for fitting
                                   (minutes) 0 => 15
DOPRINT                            If > 1 will print solutions
LSQOFF                             If = 1 will only do FFT
                                   search.
                                   ===== Plot solutions =======
PLOTSOL                            If > 1 will plot delay/rate
                                   solutions
ANTPLOT                            Antennas to plot, 0 => all
                                   === Plot calibrated data ===
PLOTCAL                            If = 1 will plot the
                                   calibrated amplitudes only.
                                   If = 2 will plot the
                                   calibrated phases only.
                                   If = 3 will plot the
                                   calibrated amplitudes &
                                   phases
                                   If = 0 will plot nothing

                                   If CHAN1 and CHAN2 are
                                   different, then data will be
                                   averaged across given channel
                                   range before plotting.
CHAN1             0.0     4096.0   Lowest channel number 0=>all
CHAN2             0.0     4096.0   Highest channel number 0=>all
                                   If BBC1 and BBC2 are different,
                                   then data will be averaged
                                   across given IF range before
                                   plotting.
BBC1              0.0      100.0   Lowest IF number 0=>all
BBC2              0.0      100.0   Highest IF number 0=>all
TSCALE                             Start and stop time to plot
                                   (fractions of a day), 0 =>
                                   plot all
ASCALE                             Min and max values of amp to
                                   plot, 0 => self-scale
PSCALE                             Min and max values of phs to
                                   plot, 0 => self-scale
                                   ===== GENERAL ===============
BADDISK            0.0        9.0  Disks to avoid.
----------------------------------------------------------------
VLBA
Procedure:  This procedure will read a VLBA FITS file, plot
     total power spectra, do basic fringe-fitting, plot
     the delays and rates, calibrate the data and then plot
     the resultant amplitudes and phases. After plotting it
     will delete the PL extension files.
        To define the procedure type:
     >RUN VLBAIT
     this only needs to be done once.
        The user can them examine the inputs to the VLBA
     procedure by typing:
     >INP VLBAIT
     To run the procedure type:
     >VLBAIT

Adverbs:
                                   ===== GLOBAL INFORMATION ==
DOTKPL......If = 0 will send the plots generated to a laser
            printer using the task LWPLA. If set to 1 will
            use the TEK emulator to display the plots, this will
            mean that the user has to hit RETURN after each
            plot because DOWAIT is true.
DOZAP.......During the running of the procedure some
            intermediate files are generated, if DOZAP = 1 these
            will be deleted when the procedure ends.
VLBSOU......The source to be processed, this must be specified.
                                   ===== VLBA FITS FILE ======
NOREAD......If > 0 will not read the FITS input file, useful
            for running parts of the procedure without having
            to do all steps.
DATAIN......48-character name of the disk file from which to
            read a FITS file.  It must be in the form
                <logical>:<file name>
            or
                <node>::<logical>:<file name>
            where <node> is the remote computer name,
            <logical> is the environment variable (logical
            name) for the disk area in which the file named
            <file name> is stored.  <node> is usually omitted
            when the file is local to the current computer.
OUTNAME.....The output filename (name).  Standard behavior
            with default = the portion of the DATAIN string
            after the ':' and before any '.' with a maximum of
            12 characters.
OUTCLASS....The output filename (class).  Default = 'RAW'
OUTSEQ......The output filename (seq #).  0 => Find the
            lowest number which produces a unique mapname.
            -1 => use the sequence number on the tape (if
            any - works only on tapes written by FITTP).
OUTDISK.....Disk drive # (0 => highest with space)
                                   ===== CL GENERATION =======
GENCL.......If GENCL > 1 then a new default CL table will be
            generated. At the current time (Apr 5 1993) the
            VLBA FITS files do not carry the CL table - they
            will soon.
                                   ===== Plot raw data =====
PLOTRAW.....If PLOTRAW > 0 then the raw amplitudes and phases
            will be plotted.  Use CHAN1, CHAN2, BBC1, BBC2 to
            select data combined for each baseline.  Phases
            are plotted on a fixed +/- 180-degree Y-axis.
            There will be 5 plots/page.

                                   ===== Plot TP spectra =====
PLOTTP......If PLOTTP > 1 then the total power spectra from
            each antenna will be plotted. All spectral
            channels and BBC's will be on the same plot.
            There will be 2 plots/page.
                                   ===== Do fringe fitting ===
DOFRNG......If DOFRNG > 1 then the data will be fringe-fitted.
            FRING will be run in a mode in which the delays
            and rates are determined independently for each
            BBC.
FRNGANT.....Reference antenna for fitting
FRINGINT....Solution interval for fitting (minutes) 0 => 15 min
DOPRINT.....If > 1 will print delay/rate solutions.
LSQOFF......If = 1 will only do FFT search, i.e. will switch off
            the least-squares portion.
                                   ===== Plot solutions =======
PLOTSOL.....If PLOTSOL > 1 then the delay/rate solutions will be
            plotted for each antenna listed in ANTPLOT. The
            delays/rates for all BBC's will be plotted in one
            plot, with one antenna/page.
ANTPLOT.....Antennas to plot, 0 => all. If there is an antenna
            with no solutions SNPLT will die, there is no easy
            way to trap this in a POPS procedure so the user
            must specify the antennas he/she knows are there.
                                   === Plot calibrated data ===
PLOTCAL.....If PLOTCAL > 0 then the calibrated amplitudes
            and/or phases will be plotted.
            If = 1 will plot the calibrated amplitudes only.
            If = 2 will plot the calibrated phases only.
            If = 3 will plot the calibrated amplitudes &
            phases.
            If = 0 will plot nothing.
            There will be 5 plots/page.
            Channel selection:
            If CHAN1 and CHAN2 are different, then data will be
            averaged across given channelrange before plotting.
CHAN1.......Lowest channel number 0=>1
CHAN2.......Highest channel number 0=>all
            If BBC1 and BBC2 are different,then data will be
            averaged across given IF range before plotting.
BBC1........Lowest IF number 0=>1
BBC2........Highest IF number 0=>all
TSCALE......The start and end times to plot, in fractions of
            a day. 0 => plot all times.
ASCALE......The minimum and maximum amplitude to plot. 0 =>
            self-scale.
PSCALE......The minimum and maximum phase (degrees) to plot.
            0 => self-scale.
                                   ===== GENERAL ===============
BADDISK.....Disks to avoid.
----------------------------------------------------------------
