; PCFIT
;---------------------------------------------------------------
;! Finds delays and phases using a pulse-cal (PC) table
;# Task SPECTRAL UV CALIBRATION PLOT VLBI
;-----------------------------------------------------------------------
;;  Copyright (C) 2016-2017
;;  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
;-----------------------------------------------------------------------
PCFIT     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
PCFIT     Fits pulse-cal tables for delay and phase
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 #
INVERS            0.0              Table version to plot
FREQID            0.0              Frequency ID code to plot.
SUBARRAY          0.0              Subarray to plot; 0 => 1
TIMERANG                           Range of times to include
SOLINT                             Time averaging interval (min)
NPIECE            0.0        90.0  Number of delays fit in each
                                   polarization, antenna, time
OPTYPE                             'TOTA' -> write total delays
                                   and phases, else write delay
                                   and phase differenced from
                                   first time
CUTOFF            0.0              If delay changes by > CUTOFF
                                   ns, set a new zero  0 -> 100
PRTLEV            0.0              > 0   print solutions,
                                   > 1.5 print initial guesses
----------------------------------------------------------------
PCFIT
Type:  Task
Use:   To fit delays and phases to PC-table data, writing a new SN
       table and a new PC table, the latter containing the residual PC
       values after the fit delays and phases are subtracted.

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.
  INVERS.....Specifies the version of the PC table to be read as
             input.   0 -> highest.
  FREQID.....Specifies which frequency ID to fit.  0 => 1.
  SUBARRAY...The subarray number to be fit.  0 => 1.
  TIMERANG...Time range to be fit: start day, hour, min, sec, end day,
             hour, min, sec.
  SOLINT.....Time averahing interval in minutes.  -1 => scan average.
             0 => fit each sample individually.
  NPIECE.....Break up IFs into NPIECE pieces for fit: 0 -> Number of
             IFs in PC table.  1 -> fit one delay to all IFs, 2 -> fit
             one delay to the first half of the IFs and a second to
             the second half, and so on.
  OPTYPE.....'TOTA' => write the delays and phases as they are fit to
             the PC table data.  Otherwise, write the current fit
             minus the values from the first time ("zero point").
  CUTOFF.....If the delay changes by more than CUTOFF ns, issue a
             message and reset the zero point.  0 -> 100 ns
             < 0 -> do not do this.
  PRTLEV.....> 0 -> print solutions with errors
             > 1.5 -L also print initial guess going into fitter
----------------------------------------------------------------
