; FRING
;---------------------------------------------------------------
;! fringe fit data to determine antenna calibration, delay, rate
;# TASK CALIBRATION AP VLBI
;-----------------------------------------------------------------------
;;  Copyright (C) 1995-2004, 2006, 2009-2010, 2012, 2015-2016
;;  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
;-----------------------------------------------------------------------
FRING     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
FRING:  Task to fringe fit data
                                   Input uv data.
INNAME                                UV file name (name)
INCLASS                               UV file name (class)
INSEQ              0.0      9999.0    UV file name (seq. #)
INDISK             0.0         9.0    UV file disk drive #
                                   Data selection (multisource):
CALSOUR                            Calibrator sources
QUAL            -10.0              Calibrator qualifier -1=>all
CALCODE                            Calibrator code '    '=>all
SELBAND                            Bandwidth to select (kHz)
SELFREQ                            Frequency to select (MHz)
FREQID                             Freq. ID to select.
TIMERANG                           Time range to use.
BCHAN             0.0     2048.0   Lowest channel number 0=>all
ECHAN             0.0     2048.0   Highest channel number
CHINC             0.0              Spectral channel increment
                                   (data are averaged)
ANTENNAS                           Antennas to select. 0=all
DOFIT                              Subset of ANTENNAS list
                                   for which solns are desired.
SUBARRAY          0.0     1000.0   Subarray, 0=>all
UVRANGE                            Range of uv distance for full
                                   weight
WTUV                               Weight outside UVRANGE 0=0.
WEIGHTIT          0.0        3.0   Modify data weights function

                                   Cal. info for input:
DOCALIB          -1.0      101.0   > 0 calibrate data & weights
                                   > 99 do NOT calibrate weights
GAINUSE                            CL table to apply.
DOPOL            -1.0       10.0   If >0 correct polarization.
PDVER                              PD table to apply (DOPOL>0)
BLVER                              BL table to apply.
FLAGVER                            Flag table version
DOBAND           -1.0       10.0   If >0 apply bandpass cal.
                                   Method used depends on value
                                   of DOBAND (see HELP file).
BPVER                              Bandpass table version
SMOOTH                             Smoothing function. See
                                   HELP SMOOTH for details.

                                   CLEAN map (optional)
IN2NAME                               Cleaned map name (name)
IN2CLASS                              Cleaned map name (class)
IN2SEQ            0.0     9999.0      Cleaned map name (seq. #)
IN2DISK           0.0        9.0      Cleaned map disk unit #
INVERS           -1.0    46655.0   CC file version #.
NCOMP                              # comps to use for model.
                                   1 value per field
FLUX                               Lowest CC component used.
NMAPS             0.0     4096.0   No. Clean map files
CMETHOD                            Modeling method:
                                   'DFT','GRID','    '
CMODEL                             Model type: 'COMP','IMAG'
                                   'SUBI' (see HELP re images)
SMODEL                             Source model, 1=flux,2=x,3=y
                                   See HELP SMODEL for models.

                                   Output uv data file.
DOAPPLY           -1.0         1.0    >= 0 write output
OUTNAME                               UV file name (name)
OUTCLASS                              UV file name (class)
OUTSEQ            -1.0      9999.0    UV file name (seq. #)
OUTDISK            0.0         9.0    UV file disk drive #

                                   Solution control adverbs:
REFANT                             Reference antenna
SEARCH            0.0     1000.0   Prioritized reference antenna
                                   list - supplements REFANT
                                   - but only if APARM(9)>0
SOLINT                             Solution interval (min)
                                   0 => 10 min
SOLSUB                             Solution subinterval
SOLMIN                             Min solution interval

APARM                              General parameters
                                      1=min. no. antennas
                                      2 > 0 => data divided
                                      3 > 0 => avg. RR,LL
                                      4 > 0 => avg. freq. in IFs
                                      5 = 1 => combine all IFs
                                        = 2 => also MB delay
                                        = 3 => combine IFs in
                                               halves
                                        = 4 => combine IFs in
                                               thirds
                                        = N => combines IFs in
                                               N-1 pieces
                                        SEE HELP WARNING
                                      6=print level, 1=some
                                      7=SNR cutoff (0=>5)
                                      8=max. ant. # (no AN)
                                      9 > 0 => do exhaustive
                                               baseline search
                                     10 > 0 -> fit dispersion
                                        and IF group delay after
                                        fit of SB delays
DPARM                              Delay-rate parameters
                                      1=no. bl combo. (def=3)
                                      2=delay win (nsec), if <0
                                        no delay search done
                                      3=rate win (mHz)
                                      4=int. time (sec)
                                       0 => min. found in data
                                      5 >0 => don't do ls. soln
                                      6 >0 => don't avg. in freq
                                      7 >0 => don't rereference
                                        phase
                                      8 > 0 => activate zero'ing
                                                options
                                      9 > 0 => do not fit rate
SNVER             -1.0     46655.0 Output SN table, 0=>new table
ANTWT                              Ant. weights (0=>1.0)
BIF                                First IF included when
                                   APARM(5) > 0
EIF                                Last IF included when
                                   APARM(5) > 0
BADDISK            0.0        15.0 Disk no. not to use for
                                      scratch files.
----------------------------------------------------------------
FRING
Task:  This task determines the group delay and phase rate calibration
       to be applied to a uv data set given a model of the source(s).
       The output data will have the corrections applied for a single
       source input file; and a solution (SN) table will be left for a
       multi source data set.  SN tables will be attached to the INPUT
       data file.
            Model images made with both values of IMAGR's DO3DIMAG
       option are handled correctly, as are multi-scale images.  Set
       NMAPS = NFIELD * NGAUSS.
            FRING now uses dynamic memory throughout, allowing large
       delay-rate searches no matter what size the pseudo AP may be.
       Of course, your computer must have enough memory to support
       this allocation.
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.

The following are used for multisource data files only:
  CALSOUR....List of sources for which calibration constants are to be
             determined, i.e. the calibrator sources  All ' ' = all
             sources; a "-" before a source name. means all except ANY
             source named.  Note: solutions for multiple sources can
             only be made if the sources are point sources at their
             assumed phase center and with the flux densities given in
             the source (SU) table.
  QUAL.......Only sources with a source qualifier number in the SU table
             matching QUAL will be used if QUAL is not -1.
  CALCODE....Calibrators may be selected on the basis of the calibrator
             code:
                  '    ' => any calibrator code selected
                  '*   ' => any non blank code (cal. only)
                  '-CAL' => blank codes only (no calibrators)
                  anything else = calibrator code to select.
             NB: The CALCODE test is applied in addition to the other
             tests, i.e. CALSOUR and QUAL, in the selection of sources
             for which to determine solutions.
  SELBAND....Bandwidth of data to be selected. If more than one IF is
             present SELBAND is the width of the first IF required.
             Units = kHz, 0=> all
  SELFREQ....Frequency of data to be selected. If more than one IF is
             present SELFREQ is the frequency of the first IF required.
             Units = MHz, 0=> all
  FREQID.....Frequency identifier to select (you may determine which is
             applicable from the OPTYPE='SCAN' listing produced by
             LISTR.  If either SELBAND or SELFREQ are set their values
             override that of FREQID, however setting SELBAND and
             SELFREQ may result in an ambiguity, in which case the task
             will request that you use FREQID.
  TIMERANG...Time range of the data to be used. In order: Start day,
             hour, min. sec, end day, hour, min. sec. Days relative to
             reference date.
  BCHAN......First channel to use. 0=>all.
  ECHAN......Highest channel to use. 0=>all higher than BCHAN
  CHINC......Channel increment in fitting - note channels are averaged
             BCHAN to BCHAN+CHINC-1, BCHAN+CHINC to BCHAN+2*CHINC-1,
             etc.  This reduces the memory requirements and is
             suitable for delay errors that are not too large to cause
             channel-to-channel loss of coherence.
  ANTENNAS...A list of the antennas to  have solutions determined. If
             any number is negative then all antennas listed  are NOT to
             be used to determine solutions and all others are. All 0 =>
             use all.
  DOFIT......A list of the antennas for which solutions should or
             should not be determined.  If DOFIT = 0, all antennas are
             solved for.  If any entry <= -1, , then DOFIT is taken as
             the list of antennas for which no solution is desired; a
             solution is found for all antennas not in DOFIT.  If any
             entry of DOFIT is non-zero and all are >= 0, then only
             those antennas listed in DOFIT will be solved for - all
             other selected antennas will not be solved for.
             NOTE: THIS OPTION MUST NOT BE USED UNLESS YOU UNDERSTAND
             IT FULLY.  Basically, it should be used to solve for the
             gains of "poor" antennas after the "good" antennas have
             been fully calibrated.  Antennas included in ANTENNAS but
             not in DOFIT are assumed to have a complex
             gain/delay/rate of (1,0,0,0) and the gains/delays
             produced will be very wrong if this is not the case.
             See HELP DOFIT.
The following may be used for all data files (except as noted):
  SUBARRAY...Subarray number to use. 0=>all.
  UVRANGE....The range of uv distance from the origin in kilowavelengths
             over which the data will have full weight; outside of this
             annulus in the uv plane the data will be down weighted by a
             factor of WTUV.
  WTUV.......The weighting factor for data outside of the uv range
             defined by UVRANGE.
  WEIGHTIT...If > 0, change the data weights by a function of the
             weights just before doing the solution.  Choices are:
             0 - no change   weighting by 1/sigma**2
             1 - sqrt (wt)   weighting by 1/sigma may be more stable
             2 - (wt)**0.25
             3 - change all weights to 1.0
  DOCALIB....If true (>0), calibrate the data using information in the
             specified Cal (CL) table for multi-source or SN table for
             single-source data.  Also calibrate the weights unless
             DOCALIB > 99 (use this for old non-physical weights).
             Done before determining solutions.
  GAINUSE....(multisource) version number of the CL table to apply to
             the data.   0 => highest.
  DOPOL......If > 0 then correct data for instrumental polarization as
             represented in the AN or PD table.  This correction is
             only useful if PCAL has been run or feed polarization
             parameters have been otherwise obtained.  See HELP DOPOL
             for available correction modes: 1 is normal, 2 and 3 are
             for VLBI.  1-3 use a PD table if available; 6, 7, 8 are
             the same but use the AN (continuum solution) even if a PD
             table is present.
  PDVER......PD table to apply if PCAL was run with SPECTRAL true and
             0 < DOPOL < 6.  <= 0 => highest.
  BLVER......Version number of the baseline based calibration
             (BL) table to appply. <0 => apply no BL table,
             0 => highest.
  FLAGVER....Specifies the version of the flagging table to be applied.
             0 => highest numbered table.  <0 => no flagging to be
             applied.
  DOBAND.....(multi-source) If true (>0) then correct the data for the
             shape of the antenna bandpasses using the BP table
             specified by BPVER.  The correction has five modes:
             (a) if DOBAND=1 all entries for an antenna in the table
             are averaged together before correcting the data.
             (b) if DOBAND=2 the entry nearest in time (including
             solution weights) is used to correct the data.
             (c) if DOBAND=3 the table entries are interpolated in
             time (using solution weights) and the data are then
             corrected.
             (d) if DOBAND=4 the entry nearest in time (ignoring
             solution weights) is used to correct the data.
             (e) if DOBAND=5 the table entries are interpolated in
             time (ignoring solution weights) and the data are then
             corrected.
  BPVER......(multi-source) version of the BP table to be applied.
             0 => highest; < 0 => no bandpass correction to be applied.
  SMOOTH.....Specifies the type of spectral smoothing to be applied to
             a uv database . The default is not to apply any smoothing.
             The elements of SMOOTH are as follows:
             SMOOTH(1) = type of smoothing to apply: 0 => no smoothing
               To smooth before applying bandpass calibration
                 1 => Hanning, 2 => Gaussian, 3 => Boxcar, 4 => Sinc
               To smooth after applying bandpass calibration
                 5 => Hanning, 6 => Gaussian, 7 => Boxcar, 8 => Sinc
             SMOOTH(2) = the "diameter" of the function, i.e. width
               between first nulls of Hanning triangle and sinc
               function, FWHM of Gaussian, width of Boxcar. Defaults
               (if < 0.1) are 4, 2, 2 and 3 channels for SMOOTH(1) =
               1 - 4 and 5 - 8, resp.
             SMOOTH(3) = the diameter over which the convolving
               function has value - in channels.  Defaults: 1,3,1,4
               times SMOOTH(2) used when input SMOOTH(3) < net
               SMOOTH(2).

The following specify a CLEAN model to be used if a single source was
specified in CALSOUR:
  IN2NAME....Cleaned map name (name).      Standard defaults.
             Note: a CLEAN image for only a single-source may
             be given although it may be in a multi-source file.
             If the source table contains a flux, then that flux will
             be used to scale the components model to obtain the
             stated total flux.  This is needed since initial Cleans
             may not obtain the full flux even though they represent
             all the essentials of the source structure.
  IN2CLASS...Cleaned map name (class).     Standard defaults.
  IN2SEQ.....Cleaned map name (seq. #).    0 -> highest.
  IN2DISK....Disk drive # of cleaned map.  0 => any.
  INVERS.....CC file version #.  0=> highest numbered version
  NCOMP......Number of Clean components to use for the model, one
             value per field.  If all values are zero, then all
             components in all fields are used.  If any value is not
             zero, then abs(NCOMP(i)) (or fewer depending on FLUX and
             negativity) components are used for field i, even if
             NCOMP(i) is zero.  If any of the NCOMP is less than 0,
             then components are only used in each field i up to
             abs(NCOMP(i)), FLUX, or the first negative whichever
             comes first.  If abs(NCOMP(i)) is greater than the number
             of components in field i, the actual number is used.  For
             example
                   NCOMP = -1,0
             says to use one component from field one unless it is
             negative or < FLUX and no components from any other
             field.  This would usually not be desirable.
                   NCOMP = -1000000
             says to use all components from each field up to the
             first negative in that field.
                   NCOMP = -200 100 23 0 300 5
             says to use no more than 200 components from field 1, 100
             from field 2, 23 from field 3, 300 from field 5, 5 from
             field 6 and none from any other field.  Fewer are used if
             a negative is encountered or the components go below
             FLUX.
  FLUX.......Only components > FLUX in absolute value are used in the
             model.
  NMAPS......Number of image files to use for model.  For multi-scale
             models, set NMAPS = NFIELD * NGAUSS to include the Clean
             components of the extended resolutions.  If more than one
             file is to be used, the NAME, CLASS, DISK and SEQ of the
             subsequent image files will be the same as the first file
             except that the LAST 3 or 4 characters of the CLASS will
             be an increasing sequence above that in IN2CLASS.  Thus,
             if INCLASS='ICL005', classes 'ICL005' through 'ICLnnn'
             or 'ICnnnn', where nnn = 5 + NMAPS - 1 will be used.  Old
             names (in which the 4'th character is not a number) are
             also supported: the last two characters are '01' through
             'E7' for fields 2 through 512.  In old names, the highest
             field number allowed is 512; in new names it is 4096.
  CMETHOD....This determines the method used to compute the model
             visibility values.
             'DFT' uses the direct Fourier transform, this method is
                   the most accurate.
             'GRID' does a gridded-FFT interpolation model computation
             '    ' allows the program to use the fastest method
  CMODEL.....This indicates the type of input model; 'COMP' means that
             the input model consists of Clean components, 'IMAG'
             indicates that the input model consists of images.
             'SUBI' means that the model consists of a sub-image of
             the original IMAGR output.  If CMODEL is '   ' Clean
             components will be used if present and the image if not.
             SUBI should work for sub-images made with DO3DIM true and
             sib-images of the central facet made with DO3DIM false,
             but probably will not work well for shifted facets with
             DO3DIM false.  Use BLANK rather than SUBIM in such cases.
             CALIB will set a scaling factor to correct image units
             from JY/BEAM to JY/PIXEL for image models.  If the source
             table contains a flux, then that flux will be used to
             scale the components model to obtain the stated total
             flux.  This is needed since initial Cleans may not obtain
             the full flux even though they represent all the
             essentials of the source structure.
  SMODEL.....A single component model to be used instead of a CLEAN
             components model; if abs (SMODEL) > 0 then use of this
             model is requested.
                SMODEL(1) = flux density (Jy)
                SMODEL(2) = X offset in sky (arcsec)
                SMODEL(3) = Y offset in sky (arcsec)
                SMODEL(4) = Model type:
                  0 => point model
                  1 => elliptical Gaussian and
                       SMODEL(5) = major axis size (arcsec)
                       SMODEL(6) = minor axis size (arcsec)
                       SMODEL(7) = P. A. of major axis (degrees)
                  2 => uniform sphere and
                       SMODEL(5) = radius (arcsec)
The following specify the output file to be written if the input file is
a single source file.
  DOAPPLY....< 0 -> do not write the output file.
  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
               disk number with space
The following control how the solutions are done, if you don't
understand what a parameter means leave it 0 and you will probably get
what you want.
  REFANT.....The desired reference antenna for phases.
  SEARCH.....List of Prioritized antennas to be used when APARM(9)>0.
             This adverb supplements REFANT.  Along with APARM(9)>0,
             it is recommended that SEARCH be filled
             with a list of antennas whose order reflects the user's
             notion of which baselines will be easiest to find fringes
             on.  All baselines to each antenna in SEARCH will be
             searched in order looking for fringes.  All remaining
             baselines will then be searched.  Choosing SEARCH wisely
             will speed the FFT portion of FRING.  The antenna chosen
             in REFANT is treated as SEARCH(0), ie all baselines to
             it are searched first.
  SOLINT.....The solution interval (min.)  You really should set this;
             longer values are allowed beginning with 15OCT96.
             0 => 10 minutes for all inputs
             If SOLINT > Scan/2 (in Multisource) SOLINT = Scan.
  SOLSUB.....The begin time for the next interval in advanced from the
             current one by SOLINT / SOLSUB where 1 <= SOLSUB <= 10.
             0 -> 1.  This is to produce solutions at sub-intervals of
             SOLINT based on SOLINT length of averaging.
  SOLMIN.....Minimum number of subintervals to be used in a solution.
             0 -> SOLSUB.
  APARM......General control parameters.
  APARM(1)...Minimum number of antennas allowed for a solution. 0 => 3.
  APARM(2)...If > 0 then the input data has already been divided by a
             model; only solutions will be determined.
  APARM(3)...If > 0 then average RR, LL
  APARM(4)...If > 0 average all frequencies in each IF before the
             solution and in the output for single source files.
  APARM(5)...WARNING: IF THE FREQUENCY INCREMENT BETWEEN IFS THAT WILL
             BE INCLUDED IN A GROUP HAS THE OPPOSITE SIGN FROM THE
             FREQUENCY INCREMENT BETWEEN CHANNELS IN THE IFS OF THAT
             GROUP, YOU SHOULD NOT USE THE FOLLOWING
                  (SET APARM(5)=0 ONLY).
             If = 1 then make a combined solution for the IFs;
             If <= 0 then make separate solutions.
             If = 2 do separate least squares fits for single- and
                  multi-band delays.  This option will override APARM(4)
                  > 0. WARNING: multi-band delays derived by this method
                  cannot be smoothed.
             If = 3 then make solutions combining IFs 1 through NIF/2
                  and IFs NIF/2+1 through NIF.  This may be appropriate
                  for the EVLA in which the first NIF/2 are from
                  hardware IF AC and the others are from hardware BD.
             If = 4 then make solutions combining IFs 1 through NIF/4,
                  NIF/4+1 through NIF/2, NIF/2+1 through 3*(NIF/4),
                  and IFs 3*(NIF/4)+1 through NIF.  This may be
                  appropriate for the EVLA for 3-bit sampling in which
                  each quarter passes through separate hardware and
                  hence has separate delay errors.
             NOTE - APARM(10) can partly override this - causing the
             task to fit a delay in each IF and then to fit a
             dispersion across all IFs plus delay for each group of
             IFs.  The output SN table will contain dispersion values
             plus the single-band delays and phases corrected for the
             dispersion.
  APARM(6)...Print flag, -1=none, 0=time every 10th time, 1=time,some
             info, 2=more including the antenna signal to noise ratio,
             3=a very great deal.
  APARM(7)...The minimum allowed signal-to-noise ratio.   0 => 5
  APARM(8)...If there is no antenna (AN) table with the input file then
             the maximum antenna number in the file should be entered in
             APARM(8).
  APARM(9)...If > 0, perform exhaustive baseline search in the initial
             FFT stage.  Normally, the first stage of FRING is to FFT
             individual baselines searching for initial estimates of the
             residual phases, rates, and delays.  This stage is notable
             in that FRING gives up too easily - only baselines to the
             user-selected REFANT and one other antenna are searched.
             APARM(9)>0 instructs FRING to exhaustively search for
             initial estimates for each antenna's errors.  See SEARCH
             above as well.
  APARM(10)..If > 0, causes the task to fit a delay in each IF and then
             to fit a dispersion plus a delay for each group of IFs to
             the SB delays in all IFs.  The output SN table will
             contain dispersion values plus the single-band delays and
             phases corrected for the dispersion.
  Delay-rate control parameters:
  DPARM......Delay rate parameters.
  DPARM(1)...Number of baseline combinations to use in the initial,
             coarse fringe search (1-3).  Larger values increase the
             point source sensitivity but reduce the sensitivity to
             extended sources when an accurate model is not available.
             0=>3.
  DPARM(2)...The delay window to search (nsec) centered on 0 delay.
             0 => full Nyquist range defined by the frequency spacing.
             If DPARM(2) < 0.0 no delay search will be performed.
  DPARM(3)...The rate window to search (mHz) centered on 0 rate.
             0 => full Nyquist range defined by the integration time.
  DPARM(4)...The minimum integration time of the data (sec);
             0 => search the data to find the minimum integration
                  time.
             The correct minimum of all baselines should be supplied.
  DPARM(5)...If > 0 then don't do the least squares solution. If the
             least squares solution is not done then only the coarse
             search is done and much less accurate solutions are
             obtained.
  DPARM(6)...If > 0 then the output data will not be averaged in
             frequency else, all frequencies in each IF will be
             averaged.  Affects single source files only.
  DPARM(7)...If > 0 then the phase, rate and delays will not be
             re-referenced to a common antenna.  This option is only
             desirable for VLBI polarization data.
  DPARM(8)...DPARM(8)>0 allows zero'ing of RATE, DELAY, and/or PHASE
             solutions.  ** Note that the ZEROing is done _AFTER_ the
             FRING solution is found,  this is not the mechanism for
             turning off the DELAY, RATE, or PHASE search,  see
             DPARM(2-3) for that capability. **
             DPARM(8) value   zero RATES?  zero DELAYs?  zero PHASEs?
                  0              No           No              No
                  1             Yes           No              No
                  2              No          Yes              No
                  3             Yes          Yes              No
                  4              No           No             Yes
                  5             Yes           No             Yes
                  6              No          Yes             Yes
                  7             Yes          Yes             Yes
  DPARM(9)...> 0 => supress fitting for rate (rather than just zero
             the fit afterwards).  This assumes that the true rate is
             small and causes all the data in SOLINT to be averaged
             before being fed to the fitter.  DPARM(8)=1 is not needed
             in this case.
  SNVER......Desired output SN table.  Solutions will be added to the
             specified table replacing any previous solutions for the
             same TIMERANG, CALSOUR etc. 0 means create a new SN table.
  ANTWT......Antenna weights.  These are additional weights to be
             applied to the data before doing the solutions, one per
             antenna.  Use PRTAN to determine which antenna numbers
             correspond to which antennas.
  BIF........First IF included when APARM(5)=1,3,4 (all IFs receive the
             solution found for the appropriate group of IFs, but only
             BIF-EIF are used to find it).
  EIF........Last IF included when APARM(5)=1,3,4 (all IFs receive the
             solution found for the appropriate group of IFs, but only
             BIF-EIF are used to find it).
  BADDISK....A list of disk numbers to be avoided when creating scratch
             files.
----------------------------------------------------------------
For some basic introduction to fringe fitting, please see the discussions
in:

Thompson, Moran, and Swenson
Felli and Spencer
Perley, Schwab, and Bridle

The AIPS cookbook also describes how and when FRING should be used.

