; BASFIT
;---------------------------------------------------------------
;! fits antenna locations from SN-table data
;# Procedure UV Calibration
;-----------------------------------------------------------------------
;;  Copyright (C) 2002
;;  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
;-----------------------------------------------------------------------
BASFIT    LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
BASFIT:  Procedure to calibrate and fit antenna locations
INNAME                             UV data (name).
INCLASS                            UV data (class).
INSEQ             0.0    9999.0    UV data (seq. #).  0 => high
INDISK                             Disk unit #.       0 => any
ANTENNAS                           Antennas to fit
SUBARRAY          0.0     1000.0   Subarray, 0=>1
REFANT            0.0       90.0   Reference antenna
OUTPRINT
                                   Output text file base name
DOCOLOR                            Do color plots (if > 0)
----------------------------------------------------------------
BASFIT
Type:  Procedure
Use:   Runs 3 tasks:
       1. CALIB on scan averages of all calibrator sources
       2. LOCIT to fit the phases of the SN table for antenna
          locations; prints and plots the results.
       3. LWPLA to put the plots on paper
Adverbs:
  INNAME.....UV file name (name).       Standard defaults.
  INCLASS....UV file name (class).      Standard defaults.
  INSEQ......UV file name (seq. #).     0 => highest.
  INDISK.....Disk unit #.               0 => any.
  ANTENNAS...A list of the antennas to fit.  If any number is negative
             then all antennas listed are NOT desired and all others
             are.  All 0 => fit all except REFANT.
  SUBARRAY...Subarray number to list. 0=>1.
  REFANT.....Antenna that is asumed to be fixed --- all fits are
             relative to this antenna.  Note that you may use no
             reference antenna if you wish - effectively saying that
             the reference antenna phases are all zero which they will
             be if the same REFANT was used in CALIB.  The difference
             method has no use for a REFANT.
  OUTPRINT...The output text file name without extension.  The
             extensions .FIT, .SUM, .OPR, and .VLA are written.  The
             first contains everything, the others just summaries.
             OUTPRINT = ' ' => do not write the text files.
  DOCOLOR....The procedure has two plot modes.  If DOCOLOR <= 0, one
             antenna is plotted per page with all IFs and
             polarizations in separate plots.  If DOCOLOR > 0, three
             antennas are plotted on a page, all IFs and polarizations
             are plotted together for each antenna but in different
             symbols and colors.
Comments:
   1. CALIB is run with ANTENNAS=0, CALCODE='*', APARM=3,0; SOLINT=0
      to solve for all antennas, using scan averages of all calibrator
      sources, allowing fits with 3 or more antennas.
   2. LOCIT is run in
      a) IF phase is assumed constant and is fit.
      b) No K term is found
      c) Elevations < 30 degrees are ignored
      d) Hour angles < -6 and > +6 hours are ignored.
      e) One or three antennas are plotted per page depending on
         DOCOLOR.
      f) The plots have a minimum scale of -20 to 20 degrees, but will
         go to larger values if needed.
   See LOCIT help for more information.

Plot colors (DOCOLOR true) meaning
   IF 1 Pol R = yellow RGB = (1     1     0)
      1     L = green        (0.06  1     0)
      2     R = pink         (1     0.67  1)
      2     L = cyan         (0     1     1)
   Background nearly black (0.07, 0.08, 0.03)
----------------------------------------------------------------

