; FGDIF
;---------------------------------------------------------------
;! Compares affect of 2 FG tables
;# Task UV EDITING
;-----------------------------------------------------------------------
;;  Copyright (C) 2011-2012
;;  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
;-----------------------------------------------------------------------
FGDIF     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
FGDIF    Compares the affect of two FG tables
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 #
SOURCES                            Restrict to listed sources
CALCODE                            Calibrator code ' ' all
FLAGVER                            1st Flag table version
INVERS                             2nd Flag table version
CPARM                              (1) Time interval in sec
                                       Important - see HELP.
                                   (2) > 0 limit to those flags
                                       that REFLG uses
                                   (3) > 0 => print differences
                                       in IF = CPARM(3)
                                   (4) max number messages from
                                       CPARM(3) request 0 -> 100
----------------------------------------------------------------
FGDIF
Task:  Compares the consequences of 2 flag tables to see if there are
       differences.
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.
  SOURCES....List of sources to for which flags are reviewed.  The
             task has to list all times for a source and check them
             against the flags.  Preparing the list of times can be
             expensive so this adverb lets you avoid sources which are
             not relevant to the flag table.  '*' or ' ' = all; a "-"
             before a source name means all except ANY source named.
  CALCODE....Also used to limit sources selected: '*' => any
             non-blank, '-CAL' => only blank, ' ' => all, otherwise
             must match.
  FLAGVER....Specifies the version of the 1st flagging table to be
             compared.    <= 0 => highest numbered table
  INVERS.....The 2nd flagging table to be compared.  <= 0 =>
             highest but not the same as FLAGVER.
  CPARM......(1) Normal interval between samples (IMPORTANT) in sec.
                 Use a little bit less than the normal interval.
                 0 -> 10.  This parameter can have interesting and
                 confusing consequences when data have been time
                 averaged by say UVAVG.  Let us assume you have
                 averaged 1 second data with no flags to 5 seconds and
                 that the data started at time 0.  Thenthe average
                 times will be 2, 7, 12, 17, etc seconds.  But at the
                 end of the scan (e.g. time 20) there could be onl;y
                 one 1-sec record so its averaged time would be 20.
                 Thus to separate the 17 and the 20 one must set
                 CPARM(1) = 2.9 say.  However, if the data input to
                 UVAVG already have extensive flagging, the times may
                 be disturbed from this nice pattern (depnding on
                 OPCODE in UVAVG).  In this case, the possibilities
                 are endless and there is no simple answer to a
                 correct value for CPARM(1).  (One might consider TIME
                 or even GRID in UVAVG to alleviate this issue.)  The
                 simplest thing to do in the heavy editing case might
                 be to set CPARM(1) = 0.95 at least in FGDIF.
             (2) > 0 => limit the testing to flag records that apply
                 to one baseline, fewer than all IFs, and fewer than
                 all channels.  Else include all flags.
             (3) > 0 => print the differences in detail for IF =
                 CPARM(3).
             (4) If CPARM(3) > 0, CPARM(4) is the maximum number of
                 detailed differences that will be printed.  0 -> 100.
----------------------------------------------------------------
