; SYVSN
;---------------------------------------------------------------
;! Plots selected SY/TY data with SN solution values versus time
;# Task UV Calibration Plot
;-----------------------------------------------------------------------
;;  Copyright (C) 2019-2020
;;  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
;-----------------------------------------------------------------------
SYVSN     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SYVSN:  Plots selected SY data with SN phases versus time
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
INVERS                             SY table file version no.
SNVER                              SN table file version no.
SOURCES                            Source list
QUAL            -10.0              Source qualifier -1=>all
TIMERANG                           Time range to plot
STOKES                             'R', 'L', 'RL', 'RRLL'
SELBAND                            Bandwidth to plot (kHz)
SELFREQ                            Frequency to plot (MHz)
FREQID                             Freq. ID to plot, -1=>all
SUBARRAY         -1.0              Limit to subarray; 0 -> 1
                                      -1 -> all
ANTENNAS                           Antennas to plot 0=>all
PIXRANGE                           Range to plot: 0 => self
                                   scale each antenna separately
NPLOTS            0.0      28.0    Number of plots per page
OPTYPE                             SY Data to be plotted:
                                   'PSYS','PSUM','PDIF'
REFANT                             Reference antenna: 0 none
                                   else subtract value of
                                   REFANT from all others
OPCODE                             SN data to be plotted
                                   'PHAS','DELA','AMP '
APARM                              (1,2) IF range sum SY over
                                   (3,4) IF range 1 for SY mean
                                   (5,6) IF range 2 for SY mean
                                   (7) scale SY factor
                                   (8) =1 -> plot normalized
BPARM                              (1,2) IF range sum SN over
                                   (3,4) IF range 1 for SN mean
                                   (5,6) IF range 2 for SN mean
                                   (7) scale SN factor
SAMPTYPE                           Smoothing type for corr.
                                   ' ' -> none
CPARM                              Smoothing parameters for
                                   correlation computation
XINC              0.0              Compute linear correlation
                                   coeff every XINC seconds if
                                   XAXIS < 0.  0 -> don't
CROWDED           0.0              1 -> Plot pols together
XAXIS                              Variable data is to be
                                   plotted against, 0=>time.
                                   < 0 -> do also SY vs SN
DO3COLOR         -1.0        2.0   > 0 use 3-color symbols for
                                   DO3COL=2 => color by source
SYMBOL          0.0        24.0    Plot symbol number: 1 - 24
FACTOR        -10.0        10.0    Scale plot symbols by FACTOR
                                   <0 => connect points too
DOBLANK        -1.0        24.0    > 0, show blanked values with
                                   symbol type DOBLANK
CUTOFF                             Table weights <= CUTOFF will
                                   not be plotted, flagged data
                                   are not plotted.
DOSCAN         -1.0         2.0    = 1 -> plot full boundaries
                                   = 2 -> plot ticks at scans
LTYPE        -410.0       410.0    Type of labeling: 1 border,
                                   2 no ticks, 3 - 6 standard,
                                   7 - 10 only tick labels
                                   <0 -> no date/time
DOTV           -1.0         1.0    > 0 Do plot on the TV, else
                                   make a plot file
GRCHAN          0.0         8.0    Graphics channel
XYRATIO         0.0                X/Y ratio 0 -> fit TV or 1 PL
----------------------------------------------------------------
SYVSN
Type:  Task
Use:   Plots selected calibration data versus time from specified SY
       or TY (whichever occurs in the input data set) and SN tables.
       Unlike SNPLT it constructs functions of the measured Psum,
       Psys, Pdif, Tsys, or Tant and compares them with functions of
       the SN table phases, delays, or amplitudes.

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.
  INVERS.....SY/TY table version number of table to plot,
             0=>highest no.
  SNVERS.....SN table version number of table to plot, 0=>highest no.
  SOURCES....Source list.  '*' = all; a "-" before a source name means
             all except ANY source named.
  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 plotted. In order: Start day,
             hour, min. sec, end day, hour, min. sec. Days relative to
             reference date.  If a start and stop time are given and
             the XAXIS is 1 (time), then all plots will be from the
             given start time to the given stop time.  Otherwise, the
             X-axis is plotted over the range of X values found in the
             data.  All plots in a given execution will be on the same
             X scale in any case.
  STOKES.....The desired Stokes type of the displayed data:
             'R' = RCP, 'L' = LCP, 'RL' or 'RRLL' both RCP and LCP
             'X' = XLP, 'Y' = YLP, 'XY' or 'XXYY' both XLP and YLP
  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
  SUBARRAY...Limit display to specific subarray.  -1 -> all, 0 -> 1.
  ANTENNAS...A list of the antennas to be plotted. All 0 => all.  If any
             number is negative then all antennas listed are NOT to be
             plotted and all others are.
  PIXRANGE...If PIXR(1) < PIXR(2), all plots will be from PIXR(1) to
             PIXR(2).  Otherwise each plot will be self-scaling.
  NPLOTS.....Number of antennas to plot per page (try 5).
  OPTYPE.....Data to be plotted: default PSYS
             'PSYS' = EVLA PSUM/PDIF/2 * Tcal (=Tsys) (SY)
                          uses values from the CD table
             'PSUM' = EVLA Gb * (Pon + Poff)  (SY)
             'PDIF' = EVLA Gb * (Pon - Poff)  (SY)
             'TSYS' = Tsys values from TY table
             'TANT' = Tant values from TY table
  OPCODE.....Type of SN data plot:
             'PHAS' = gain phase in degrees (default)
             'AMP ' = gain amplitude
             'DELA' = delay in ns
  APARM......(1,2) Average SY data over this range of IFs: NO DEFAULT
             (3,6) Subtract mean SY value in 1 or 2 IF ranges:
                   IFs APARM(3) through APARM(4) and APARM(5) through
                   APARM(6).  If 0 in APARM(5,6), do only APARM(3,4).
                   If 0 in APARM(3,4), do not subtract the mean.
             (7) Scale the result by APARM(7).  0 -> 1.
             (8) 1 => Plot value/mean - 1 rather than value - mean.
  BPARM......(1,2) Average SN data over this range of IFs: NO DEFAULT
             (3,6) Subtract mean SN value in 1 or 2 IF ranges:
                   IFs BPARM(3) through BPARM(4) and BPARM(5) through
                   BPARM(6).  If 0 in BPARM(5,6), do only BPARM(3,4).
                   If 0 in BPARM(3,4), do not subtract the mean.
             (7) Scale the result by BPARM(7).  0 -> 1.
  SAMPTYPE...The type of smoothing used to make the correlation
             computation: ' ' -> do not do this computation
                'BOX ' = boxcar smoothing (default)
                'MWF ' = Median window filter
                'GAUS' = Gaussian
                'EXP ' = Exponential
                'LINE' = Linear (1 - abs(t-t0)/sigma)
                '2PT ' = Two-point
                '2PTH' = Two-point + "Hanning"
  CPARM......Parameters for smoothing function to get SN and SY on the
             same grid of times (or other X axis parameters)
             Function support full-width width
               (1) => support time for SY parameter   (0 -> 30)
               (2) => support time for SN parameter   (0 -> 30)
             Added parameter (FWHM) for GAUS, EXP, LINE
               (6) => smoothing FWHM time for SY parameter
               (7) => smoothing FWHM time for SN parameter
             Units are seconds for XAXIS=1 (time), 0.01 degrees for
             elevation, parallactic angle, and azimuth, and 10s of
             seconds for hour angle and LST.
  XINC.......If XAXIS < 0, compute liner correlation coefficients
             every XINC seconds. 1 < XINC < 25 -> 180; <= 1 -> don't
  CROWDED....0 -> polarizations appear in separate panels
             1 -> polarizations appear in the same panel (use DO3COL =
                  1 to separate the two)
             2 -> the two parameters appear in the same panel (use
                  DO3COL = 1 to separate the two), polarizations are
                  in separate panels.  The SY table values are labeled
                  and the SN values are self-scaled.
  XAXIS......Variable data are to be plotted against. <= 0 => 1
              (< 0) Plot also plots with SY on the X axis and SN on
                    the Y axis, one antenna/polarization at a time.
                    NOTE: SAMPTYPE and CPARM must also be specified
              (1) = Data label time
              (2) = Antenna elevation
              (3) = Hour angle
              (4) = Local Sidereal Time
              (5) = Parallactic angle
              (6) = Antenna azimuth
                      Moving sources are supported for XAXIS 2-6 if a
                      PO table is attached.
  DO3COLOR...DO3COL = 1 tells SYVSN to plot Right or X polarization in
                 pink (graphics plane 3) and Left or Y polarization in
                 cyan (graphics plane 4).
             DO3COL = 2 tells SYVSN to separate the plotted points
                 with color representing source.  The list of source
                 numbers actually occurring in the table, time range,
                 source list, et al. is translated into consecutive
                 integers (in the same order) and then assigned red
                 through dark blue.  Thus source numbers 1,2,5,10
                 become red, yellow, cyan, and blue, resp. no matter
                 what order they appear in the table.
  SYMBOL.....1: Plus sign (default)   12: Five pointed star
             2: Cross (X)             13: Star of David
             3: Circle                14: Seven-pointed star
             4: Box                   15: Eight-pointed star
             5: Triangle              16: Nine-pointed star
             6: Diamond               17: Ten-pointed star
             7: Pentagon              18: 11-pointed star
             8: Hexagon               19: 12-pointed star
             9: Septagon              20: 13-pointed star
             10: Octagon              21: 14-pointed star
             11: Nine-gon             22: Plus with gap
                                      23: vertical line
                                      24: Cross with gap
  FACTOR.....Scale plot symbols by FACTOR     0 -> 1.
             If FACTOR < 0, draw lines between the points and use
             abs(FACTOR) to scale the points plotted.
  DOBLANK....> 0 => plot blanked solutions with a symbol of type
             DOBLANK (see symbol types above).  They will be plotted
             along the lower edge of each plot.  NOTE: if DOTV true
             and GRCHAN 0 and DO3COL <= 0, then the blanked samples
             will be in the color of graphics channel 3 (pink) and the
             good samples in the color of graphics channel 4 (blue).
             DOBLANK > 0 is forced to be different than SYMBOL by
             adding 1.
  CUTOFF.....If >= 0, the task will examine the weight column of the
             table and if the weight <= CUTOFF, the task will not plot
             that sample.  If = 0, will plot all good points; flagged
             data are not plotted.  CUTOFF is ignored for TY and PC
             tables and OPTYPEs MDEL, ATM, GEO, and CCAL.
  DOSCAN.....> 0 => plot scan boundaries when there is an NX table and
             the X axis is time.  The boundary is a tick mark when
             DOSCAN=2 and a full line when DOSCAN=1.
             <= 0 -> do not plot boundaries.
  LTYPE......Labelling type, see HELP LTYPE for details:
             1 = border, 2 = no ticks, 3 or 7 = standard, 4 or 8 =
             relative to ref. pixel, 5 or 9 = relative to subimage
             (BLC, TRC) center, 6 or 10 = pixels.  7-10 all labels
             other than tick numbers and axis type are omitted.
             Less than 0 is the same except that the plot file
             version number and create time are omitted.
             Add n * 100 to alter the metric scaling.
  DOTV.......> 0 => plot directly on the TV device, otherwise make a
             plot file for later display on one or more devices
             (including the TV if desired).
  GRCHAN.....Graphics channel (1 - 7) to use for line drawing.
             A value of 0 causes more than one graphics channel to be
             used.
  XYRATIO....Scale the X axis longer than the Y by XYRATIO.
                If DOTV >  0, 0 -> fit to the TV window
                If DOTV <= 0, 0 -> 1.
----------------------------------------------------------------
