; PRTUV
;---------------------------------------------------------------
;! prints contents of a visibility (UV) data set
;# Task UV HARDCOPY
;-----------------------------------------------------------------------
;;  Copyright (C) 1995-1996, 2000-2001, 2004, 2007, 2009-2010, 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
;-----------------------------------------------------------------------
PRTUV     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
PRTUV:  Task to print UV data stored on disk
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
SOURCES                            Source list
CHANNEL           0.0    9999.0    Frequency channel number.
BIF               0.0    9999.     IF number
BPRINT            0.0              # of first data sample.
NPRINT            0.0              # of samples. 0 => 1 page.
XINC              0.0   10000.0    List every XINC'th comp.
UVRANGE           0.0              UV range in kilolambda
CPARM             0.0              Further selection parameters:
                                   1 - 4 : start IAT (D,H,M,S)
                                   5 - 8 : end IAT (D,H,M,S)
                                   9 : 100*ant1 + ant2 + sub/100
                                   10: Multiply amplitude by
                                       CPARM(10).
DPARM                              1 : <0 => Range of (U,V,W),
                                       amplitude and weight is
                                       determined automatically;
                                       >= 0 => Ranges are fixed
                                       minimize the run time.
                                   2 : Maximum weight; 0 => 9.9
                                   3 : Minimum weight; 0 => 0.11
                                   4 : Maximum amplitude; 0=>99
                                   5 : Maximum of ABS(U),ABS(V),
                                       ABS(W) in klambda;
                                       0 => 10000
                                   6 : 0=> Print time,ant,su,fq,
                                           u,v,w,amp,phas,si(wt)
                                       1=> Print random parms
                                   7:  0=> Print amp, phas
                                       1=> Print Re, Im instead
DOCRT            -3.0     132.0    > 0 -> use the terminal,
                                   else use the line printer
                                   > 72 => terminal width
OUTPRINT                           Printer disk file to save
DOEBAR                             If > 0 list the 'error'
                                   associated with the data,
                                   rather than the weights.
                                   Note: The error is
                                   1/sqrt(aips(wt)) - ie, the
                                   data sigma times some const.
----------------------------------------------------------------
PRTUV
Type:  Task
Use:   Print UV data from a cataloged file on the line printer or the
       user's terminal.  The UV data points are listed in order as they
       appear in the file.  The user can select the first data point,
       the total number of data points printed, and the gap between data
       points in the listing.  Data points selected by these criteria
       may be rejected for actual printing on the basis of time,
       antenna(s), and/or projected spacing.
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.
  SOURCES....List of sources to be listed. '  '=> all; if any
             starts with a '-' then all except ANY source named.
  CHANNEL....Frequency channel (use 0 for continuum)
  BIF........IF number of the data to be printed.
  BPRINT.....Start listing at the BPRINT'th data point - use either
             this adverb or the start time to get improved speed in
             generating the display.
  NPRINT.....List NPRINT data points (after all data selection has been
             applied).  0 => 30000 on CRT or to a file, 1 page on printer.
             To printer the maximum printed is 2000 points, if printed
             to a file there is no limitation.
             Be aware that PRTUV now goes through the data to be printed
             twice, once to determine the u-v-w, data, and weight ranges
             and the second time to print things.  Using NPRINT to
             reduce the time required by the first pass helps when DOCRT
             is true.
  XINC.......List every XINC'th data point IF it matches the parameters
             below.
  UVRANGE....Range of projected spacings to be listed in 1000's of
             wavelengths.  0  =>  1, 1.E10
  CPARM......Further selection parameters:
     1 = Start IAT day (day 0 = first day in data base)
     2 = Start IAT hour
     3 = Start IAT minute
     4 = Start IAT second - if there is an NX table, use of the start
         time will greatly speed the display.
     5 = End IAT day (day 0 = first day in data base)
     6 = End IAT hour
     7 = End IAT minute
     8 = End IAT second (stop time < start or 0 => 1.E10)
     9 = antenna numbers: 100 * ant1 + ant2,  0 => all
             ant1 = 0  =>  all with ant2
             To limit it to one subarray, add the subarray number
             100.0.  Thus CPARM(9) = 109.02 prints baseline 1-9 from
             subarray 2 only; CPARM(9) = 109 prints baseline 1-9 from
             any subarray containing a baseline called 1-9.
    10 = Multiplier for amplitudes.
  DPARM.......Range of (U,V,W), amplitude and weight:
     (1) : < 0 => Range of (U,V,W), amplitude and weight is determined
              automatically; If the data are large, the time for
              required additional pass of the data to provide the
              scaling can be rather big. To eliminate this extra pass
              use DPARM(1)=1.
         >= 0 => The ranges are fixed to the following values:
         (2) : Maximum weight; 0 => 9.9
         (3) : Minimum weight; 0 => 0.11
               NOTE: non-zero weights that would, due to scaling, be
               printed as "0" will be shown as "-1" or "1" depending
               on their sign.
         (4) : Maximum amplitude; 0=>99
         (5) : Maximum of ABS(U),ABS(V),ABS(W) in klambda; 0 => 10000
     (6) : 0 => Print time,ant,su,fq,u,v,w,amp,phas,si(wt)
           1 => Print random parameters
         BASELINE is printed as the antennas of the baseline and the
         subarray, which is easier to comprehend.  The random
         parameter INTTIM is printed in seconds.  Times are expressed
         to millisecond accuracy.
     (7):  0 => Print amp, phas
           1 => Print Re, Im instead
  DOCRT......False (<= 0) use the line printer if OUTPRINT = ' '
                   else write named OUTPRINT file only.
                   When OUTPRINT is not blank, DOCRT=-2 suppresses the
                   page-feed character on page headers and DOCRT=-3
                   suppresses page headers and most other header
                   information.  When OUTPRINT is blank, the line
                   printer will be used.  PRTUV now counts the lines
                   to be printed before printing any and asks for
                   permission to continue if the count > 500.
             True  (> 0) use the terminal interactively.  The task will
                   use the actual terminal width as a display limit
                   unless 72 < DOCRT < width.  In that case, the display
                   limit will be DOCRT characters.
  OUTPRINT...Disk file name in which to save the line printer output.
             ' ' => use scratch and print immediately for interactive
             jobs - batch jobs use OUTPRINT = 'PRTFIL:BATCHjjj.nnn'
             (jjj= job #, nnn = user #).  When OUTPRINT is not blank,
             multiple outputs are concatenated, and the file is not
             actually printed.
  DOEBAR.....If > 0 then PRTUV will list the 'error' associated
             with the data, rather than the weights.
             Note: The error is 1/sqrt(aips(wt)) - ie, the
             data sigma times some constant (hopefully 1).

NOTE: If XINC is large and the UVRANGE and/or CPARM parameters
are used, one might obtain very little print out.
----------------------------------------------------------------

OUTPRINT, DOCRT.
Note that the use of these has changed.  DOCRT = -1 will write the named
OUTPRINT file if OUTPRINT is not blank but not spool the file to the
printer.  The OUTPRINT file can be printed out later with the usual
system level print command(s); see HELP OUTPRINT for details.
DOCRT = -1 and a blank OUTPRINT will send the output to the printer.
When  using  your terminal, use DOCRT = 132 when possible to maximize
the displayed information.

WEIGHTS
In general, the CRT display will be insufficient to print out all of
visibility #, time, baseline, u, v, w and all four (RR, RL, LR, LL)
correlators with amplitude, phase and weight for each one with
sufficient precision for each item for all purposes.  Usually, PRTUV
reports the weight with the lowest precision as a compromise.  However,
there are instances where the weights need to be known with some
precision --- for instance, when REWEIGHT is used in task 'DBCON' or in
task 'WTMOD'.  In these cases, using DOCRT = -1 and creating a disk file
or sending a print file to the printer will cause PRTUV to report the
visibility weights with higher precision than otherwise.  Alternatively,
if your CRT screen can support 132 characters per line, you may direct
the higher precision output to the CRT screen with DOCRT = 132.

PRTUV will scale the weights by powers of 10 to improve the information
content within the available space on the display.

NPRINT
There is a current limit of 2000 visibilities that can be printed to the
printer at any one time.  Should you think that this is insufficient, note
that this is about 50 pages of terminal or hardcopy output.  If you require
more visibilities than this, then it is likely that you could refine your
selection criteria somewhat or print to the terminal or a file.
