; XG2PL
;---------------------------------------------------------------
;! Plots spectrum of a pixel with XGAUS/AGAUS and ZEMAN/ZAMAN fits
;# TASK ANALYSIS PLOT SPECTRAL ONED MODELING TV-APPL POLARIZATION
;-----------------------------------------------------------------------
;;  Copyright (C) 2015-2017
;;  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
;-----------------------------------------------------------------------
XG2PL     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
XG2PL     Plots spectrum of a pixel with XGAUS and ZEMAN fits
INNAME                             Input I image name (name)
INCLASS                            Input I image name (class)
INSEQ             0.0     9999.0   Input I image name (seq. #)
INDISK            0.0        9.0   Input I image disk unit #
IN2NAME                            Input V image name (name)
IN2CLASS                           Input V image name (class)
IN2SEQ            0.0     9999.0   Input V image name (seq. #)
IN2DISK           0.0        9.0   Input V image disk unit #
INVERS            0.0              XG table version
IN2VERS           0.0              ZE table versions
APARM                              (1,2) RA, Dec pixel
                                   (3,4) I value range
                                   (5,6) V value range
                                   (7,8) Average box size in
                                      Ra, Dec
                                   (9) > 0 average even if no
                                      model
BPARM                              (1) > 0 plot I data
                                   (2) > 0 plot I model
                                   (3) > 0 plot I residual
                                   (4) > 0 plot I model comps
                                   (6) > 0 plot V data
                                   (7) > 0 plot V model
                                   (8) > 0 plot V residual
                                   (9) > 0 plot V model comps
CPARM                              (1) Plot begin channel
                                   (2) Plot end channel
                                   (3) Fraction of plot for V
                                   (4) X axis type: 0 channels
                                       1 freq, 2 velocity
                                   (5) > 0 plot X axis reversed
                                   (6) > 0 plot I and V with
                                       directly connected points
                                   (7) Plot absorption model
                                       optical depths as I
                                       (no data)
OUTTEXT
                                   Text file to contain data,
                                   model sum and model comps
                                   plus fit parameters at each
                                   pixel
XYRATIO         0.0                X to Y ratio of plot: 0 ->
                                      1 or fit to TV
LTYPE        -410.0       410.0    Type of labeling: 1 border,
                                   2 no ticks, 3 standard, 4 rel
                                   to center, 5 rel to subim cen
                                   6 pixels, 7-10 as 3-6 with
                                   only tick labels
                                   <0 -> no date/time
DOTV           -1.0                > 0 Do plot on the TV, else
                                   make a plot file
GRCHAN          0.0         8.0    Graphics channel 0 => 1.
----------------------------------------------------------------
XG2PL
Task:  Makes a plot as a plot file or on the TV of the spectrum taken
       from a transposed image cube.  It plots the data from a single
       pixel or the average of a rectangular or circular region
       centered on the pixel.  It will normally be used after running
       XGAUS or AGAUS and perhaps also after running ZEMAN or ZAMAN.
       In that case, it can also plot the XGAUS/AGAUS and ZEMAN/ZAMAN
       models and residuals.  The plot consists of an upper part with
       the total intensity parts of the plot ("I") and a lower part
       with the V polarization parts.  If the V image is not
       specified, or no V plot types are requested, then the lower
       portion is omitted.  The "I" image must be present, but if no I
       plot types are selected, then the I portion of the plot is
       omitted.

       See also AIPS Memo 118, "Modeling spectral cubes in AIPS",
       January 2016 for a more detailed description of the use of this
       task.
Adverbs:
  INNAME.....Transposed I image name (name).       Standard defaults.
  INCLASS....Transposed I image name (class).      Standard defaults.
  INSEQ......Transposed I image name (seq. #).     0 => highest.
  INDISK.....Transposed I image disk #.   0 => any.
  IN2NAME....Transposed V image name (name).       Standard defaults.
  IN2CLASS...Transposed V image name (class).      Standard defaults.
  IN2SEQ.....Transposed V image name (seq. #).     0 => highest.
  IN2DISK....Transposed V image disk #.   0 => any.
  INVERS.....XG table version: 0 => highest
  IN2VERS....ZE table version: 0 => highest
  APARM......(1,2) RA, Dec pixel  NO DEFAULT
             (3,4) I value plot range, min to max.  If max <= min,
                   self-scale I plot
             (5,6) V value plot range, min to max.  If max <= min,
                   self-scale I plot
             (7,8) Average over a box 2*APARM(7)+1 by 2+APARM(8)+1
                   in the RA, Dec coordinates around APARM(1,2)
                   If APARM(7) < 0, use APARM(8) as a radius in pixels
                   of a circle surrounding APARM(1,2).
             (9) > 0 => include pixels in average even if no model
  BPARM......(1) > 0 plot I data from INNAME at the pixel given by
                   APARM(1) and APARM(2) (axes 2 and 3 in the
                   transposed image)
             (2) > 0 plot I model sum at the pixel from XG table
                   INVERS
             (3) > 0 plot I data minus model
             (4) > 0 plot I model individual components from XG table
                   INVERS at the pixel
             (6) > 0 plot V data from IN2NAME at the pixel given by
                   APARM(1) and APARM(2) (axes 2 and 3 in the
                   transposed image)
             (7) > 0 plot V model sum at the pixel from the XG and ZE
                   tables
             (8) > 0 plot V data - model
             (9) > 0 plot V model individual components from the XG
                   and ZE tables
  CPARM......(1) The data are computed and printed over all spectral
                 channels in the image (first axis).  Those plotted
                 may be restricted to a smaller range from CPARM(1)
                 through CPARM(2).  Default is full range.
             (2) Highest channel plotted.
             (3) Fraction of vertical axis for the V plot.  0 -> 0.5.
             (4) type of X axis label: 1 frequency, 2 velocity, else
                 channels
             (5) > 0 => plot data in reverse order (on X axis)
             (6) <= 0 => I and V data are plotted with step lines
                 > 0  => I and V points are directly connected
                 Models, resduals, and model components are all
                 plotted with directconnections.
             (7) > 0 -> for absorption models, plot the data and model
                 optical depths rather than the absorption spectrum
  OUTTEXT....If not blank, print table of spectra including columns
             for data, model, and multiple model components even if
             they are not plotted.  All channels are printed.
             The model values at each pixel included in the average
             are also displayed.
  XYRATIO....Scale the X axis relative to the Y by XYRATIO.
                If DOTV >  0, 0 -> fit to the TV window
                If DOTV <= 0, 0 -> 1.
  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.
             0 => use 1 for labeling and model, 2 for data, 3 for
             residual, and 4 for components.  In this way color will
             help you separate the various types of plot.
----------------------------------------------------------------
