; PLOTC
;---------------------------------------------------------------
;! Plots color schems used by 3-color plot tasks
;# Task UV Plot
;-----------------------------------------------------------------------
;;  Copyright (C) 2018-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
;-----------------------------------------------------------------------
PLOTC     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
PLOTC     Plots colors used by AIPS tasks suitably labeled
PRTASK                             Task whose colors are plotted
INNAME                             Input UV file name (name)
INCLASS                            Input UV file name (class)
INSEQ             0.0     9999.0   Input UV file name (seq. #)
INDISK                             Input UV file disk unit #
SOURCES                            Sources to plot, ' '=>all.
STOKES                             Desired Stokes in plot
BCHAN             0.0     4096.0   1st spectral channel #
ECHAN             0.0     4096.0   Last spectral channel #
NCHAV             0.0     4096.0   # of channels to average
CHINC             0.0     4096.0   Increment in channel #
BIF                                Low IF number to plot
EIF                                Highest IF number to plot
DO3COLOR       -1.0         2.0    > 0 use 3-color to separate
                                   channels and IFs; see explain
                                   = 2 SNPLT separate sources
                                   = 2 ELFIT separate sources
INEXT                              SNPLT/SNIFS/ELFIT only:
                                       extension type
INVERS                             SNPLT/SNIFS/ELFIT only:
                                       extension version
CROWDED        -1.0         3.0    VPLOT only: degree of color
                                       use
OPCODE                             For SNIFS: ALAN, ALTI
                                   For ANBPL: ALIF, ALST, ALSI
REFANT                             Antenna for SNIFS ALTI
SOLINT                             Averaging interval for
                                       SNIFS ALTI (seconds)
TIMERANG                           Time range for BPEDT, PCEDT
DOTV          -10.0        10.0    > 0 Do plot on the TV, else
                                       make a plot file
GRCHAN          0.0         8.0    Graphics channel 0 => 1.
XYRATIO         0.0                X/Y ratio 0 -> fit TV or 1 PL
----------------------------------------------------------------
PLOTC
Type: Task
Use:  Plots an image of the colors used by the task specified with
      PRTASK.  Certain options for SNPLT, SNIFS, and ELFIT actually
      require reading the table specified by INEXT and INVERS.  The UV
      data file is opened briefly, but not read.  The header
      parameters affect BIF, EIF, BCHAN, and ECHAN, however.  The
      source table is used to handle adverb SOURCES for SNIFS
      (OPCODE='ALTI'), and SNPLT and ELFIT (DO#COL=2).

      The task fills an array in memory and then displas the plot as
      an image.  The labeling is plotted separately.  When making a
      plot file, but planning to plot it on the TV with TVPL, set
      XYRATIO to some value such as 1.4.  This will decrease the Y
      number of pixels from 1000 to 1000/1.4 which may be required to
      fit on the TV screen.  Note that tasks like UVPLT handle this
      parameter differently, keeping the Y number of pixels >= 1000
      for plot accuracy.  That accuracy is not needed with PLOTC.

      This task may be used before making the intended plot in order
      to help decide the required adverb values to enable you to
      decide, for example, what spectral channel on the UVPLT plot is
      the bad one.  It may require running PLOTC, then UVPLT, then
      PLOTC with a narrower range of channels, and finally UVPLT over
      again to enable all this.  You may wish to have two aips numbers
      running with separate TV displays (using tv=local).  This will
      allow you to view the PLOTC output and also the, e.g. UVPLT
      output.
Adverbs:
  PRTASK.....Name of task whose colors are to be plotted.
             Supported tasks:
                  ANBPL
                  BPEDT
                  EDITA
                  EDITR
                  ELINT
                  ELFIT
                  PCEDT
                  SNEDT
                  SNIFS
                  SNPLT
                  UVPLT
                  VPLOT
             Tasks which are not supported here include BPLOT and
             PCPLT which should be self explanatory and GCPLT and
             TARPL which are not in common use and which have a
             complex manner in which the colors are employed.
  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....SNPLT, SNIFS, ELFIT only:
             List of sources to be plotted. '  '=> all; if any starts
                with a '-' then all except ANY source named.
  BCHAN......Beginning spectral line channel number.   0 => 1.
  ECHAN......Ending spectral line channel number.   0 => max.
  NCHAV......Number of spectral channels to average before plotting.
                0 => 1.  NCHAV is only used to set CHINC when needed
                and to correct ECHAN.
  CHINC......Increment in spectral line channel number.   0 => NCHAV
             As used in UVPLT.
  BIF........First IF number to plot.              0 => 1
  EIF........Last IF number to plot.               0 => highest
  DO3COLOR...Any value => use 3-color vectors in the plot symbols to
                allow the polarizations, channels and/or IFs to be
                distinguished.  BIF, BCHAN, pol 1 is full red,
                EIF,ECHAN,pol n is full blue.  IF is the outer loop,
                so if there are 2 IFs, the channels and polarizations
                of IF 1 will range from red to green and those of IF2
                will range from green to blue.  Note that blue vectors
                may overlap and obscure red ones. (but not in PLOTC).
             For PRTASK = 'SNPLT' and 'ELFIT' only:
             DO3COL = 2 tells PLOTC to plot the colors used by these
               tasks to represent 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.
  INEXT......For PRTASK='SNPLT', 'SNIFS', 'ELFIT' - the extension type
               being plotted 'SN','TY, 'SY', or 'CL'
  INVERS.....For PRTASK='SNPLT', 'SNIFS', 'ELFIT', 'BPEDT', 'PCEDT':
               version number for INEXT. 0 -> max
  CROWDED....For PRTASK = 'VPLOT' only"
             <= 0  => Plot IFs and spectral channels individually
                      multiple polarizations, if requested, do appear
                      in the same panel.
             =  1  => Plot spectral channels together in one panel but
                      separate panels for separate IFs
             =  2  => Plot IFs together in one panel but separate
                      panels for each spectral channel
             =  3  => Plot spectral channels and IFs together in one
                      panel (per baseline)
  OPCODE.....For ANBPL:
             'ALIF' => will plot data for all IFs (BIF through EIF) on
                    a single plot (antennas and polarizations are
                    plotted separately).
             'ALST' => will plot data for both parallel polarizations
                    on a single plot (antennas and IFs are plotted
                    separately).
             'ALSI' => will plot data for both parallel polarizations
                    and all IFs (BIF through EIF) on a single plot
                    (antennas are plotted separately).
             For SNIFS:
             'ALAN' => will plot the time average of the table values
                    over each SOLINT with all antennas appearing in
                    one plot
             'ALTI' => will plot each time point in SOLINT in a single
                    plot with one plot per antenna.  NOTE: PLOTC does
                    not examine the table data for validity, unlike
                    SNIFS.  It simply counts the number of samples in
                    the first SOLINT for the specified REFANT.  The
                    number of samples for an antenna will actually
                    vary for each SOLINT so the plot will only be
                    approximate.
  REFANT.....For SNIFS with OPCODE='ALTI': the antenna for which the
               number of samples in the first SOLINT interval is
               counted.  0 -> 1
             For BPEDT and PCEDT: the antenna for which the times are
               found
  SOLINT.....For SNIFS with OPCODE='ALTI': the solution interval in
               seconds.   0 -> 600
  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.
  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. 0 => 1.
  XYRATIO....Scale the X axis longer than the Y by XYRATIO.
                If DOTV >  0, 0 -> fit to the current TV window
                If DOTV <= 0, 0 -> 1.
----------------------------------------------------------------
