; EVASN
;---------------------------------------------------------------
;! Evaluates statistics in SN/CL tables
;# Task UV Calibration
;-----------------------------------------------------------------------
;;  Copyright (C) 2009
;;  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
;-----------------------------------------------------------------------
EVASN     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
EVASN:   evaluates statistics in SN/CL tables
INNAME                             UV data (name).
INCLASS                            UV data (class).
INSEQ             0.0    9999.0    UV data (seq. #).  0 => high
INDISK            0.0       9.0    Disk unit #.  0 => any
INEXT                              Input'SN' or 'CL' table
INVERS                             Input table file version no.
SOURCES                            Source list
QUAL            -10.0              Source qualifier -1=>all
TIMERANG                           Time range to consider
STOKES                             Stokes type to consider
SELBAND                            Bandwidth to include (kHz)
SELFREQ                            Frequency to include (MHz)
FREQID                             Freq. ID to include, -1=>all
BIF               0.0      100.0   First IF to consider, 0=>1.
EIF               0.0      100.0   Last IF to consider
SUBARRAY          0.0              Subarray to consider: 0 ->1
ANTENNAS                           Antennas to consider 0=>all
CUTOFF                             Table weight below which data
                                   will not be considered, 0 =>
                                   consider all.
DPARM                              Control parameters
                                   (1) max acceptable deviation
                                       from mean gain amplitude
                                       in (robust) rms's
                                   (2) min acceptable cos of
                                       Delta phase
----------------------------------------------------------------
EVASN
Type:  Task
Use:   Examines the statistics in an SN or CL table.  It determines
       the mean and rms of the amplitude of the gain in a robust
       fashion and then determines the number and level of outliers.
       It examines the decorrelation on baselines due to the changes
       in phase between calibrations.  All sources may be considered
       in SN tables (or limited with the SOURCES adverb) but only
       sources with a non-blank CALCODE will be examined in CL tables.

       Note that similar considerations may be used in SNFLG to flag
       the observations.

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.
  INEXT......'SN' or 'CL' table to be consider
  INVERS.....Version number of table to consider, 0=>highest no.
  SOURCES....Source list.  '*' = all; a "-" before a source name means
             all except ANY source named.  'ALL' means to ignore the
             source identifier in the SN/CL table and combine all of
             them into one "source".
  QUAL.......Only sources with a source qualifier number in the SU
             table matching QUAL will be used if QUAL is not -1.
  TIMERANG...Time range of the data to be considered. In order:
             Start day, hour, min. sec, end day, hour, min. sec. Days
             relative to reference date.
  STOKES.....The desired Stokes type to be considered
             'R' = RCP, 'L' = LCP, else the phase difference of R and
             L is treated as the data for JUMP or the ratio of
             R and L gains is treated as the data for AMP.
  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.
  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.
  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 overide that of FREQID.  However, setting SELBAND
             and SELFREQ may result in an ambiguity.  In that case,
             the task will request that you use FREQID.  -1 => all,
             0 => first
  BIF........Lowest IF to consider.   0 -> 1
  EIF........Highest IF to consider.  0 -> highest
  ANTENNAS...A list of the antennas to be considered. All 0 => all.
             If any number is negative then all antennas listed are
             NOT to be considered and all others are.
  CUTOFF.....If >= 0, the task will examine the weight column of the
             table and if the weight < CUTOFF, the task will consider
             that sample to be bad.  All samples with weight <= 0 are
             considered bad.  An FG table entry will be generated for
             the time surrounding a bad solution.
  DPARM......(1) View as "excess" and gain amplitudes that differ from
                 the robust mean gain solution be more than DPARM(1)
                 times the robust rms on a per source, antenna, IF,
                 and polarization basis.    0 -> 6
                 The robust mean gain amplitude and its rms are
                 reported as a function of IF and polarization.
                 The fraction of samples having excess amplitude and
                 the average of that excess (in rms's) are reported.
             (2) Gain phases are examined between the current and
                 previous solution time on a per source, antenna, IF,
                 and polarization basis.  If the cosine of the
                 difference in phase is < DPARM(2), then the
                 correlation is viwed as low.  >= 1, <= -1, 0.0 -> 0.5
                 Then mean and rms correlation are reported as a
                 function of IF and polarization.  Note that a
                 correlation of 1.0 is full correlation (Delta phase
                 = 0).  The fraction of samples having a low
                 correlation and the average of those samples are
                 reported.
----------------------------------------------------------------
