; SNEDT
;---------------------------------------------------------------
;! Interactive SN/CL/TY/SY table editor using the TV
;# TASK UV VLBI CALIBRATION EDITING TV-APPL INTERACTIVE OOP AP
;-----------------------------------------------------------------------
;;  Copyright (C) 1995-1996, 1998-2000, 2003, 2006, 2010, 2012
;;  Copyright (C) 2014-2016, 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
;-----------------------------------------------------------------------
SNEDT     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SNEDT: Interactive SN/CL/TY/SY-table data editor using the TV
INNAME                             Input UV data (name)
INCLASS                            Input UV data (class)
INSEQ                              Input UV data (seq. #)
INDISK                             Input UV data disk drive #
INEXT                              Input 'SN', 'CL', 'TY' table
INVERS                             Input table file version no.
DODELAY          -1.0       3.0    > 0 => also edit delay/rate
                                   = 2 => edit MB delay only
                                   = 3 => edit dispersion only
TIMERANG                           Time range to include
BIF                                First IF to include
EIF                                Last IF to include
ANTENNAS          0.0              List of antennas to include
FREQID           -1.0              Frequency ID; 0 => 1
SUBARRAY          0.0              Subarray number 0 => 1.
FLAGVER          -1.0              > 0 FG version applied
SOLINT            0.0              Times within SOLINT (min) are
                                   treated as equal.
DETIME            0.0              Break interval (min)
DOTWO            -1.0       1.0    True => do second observable
                                   plot of main baseline
EXPERT           -1.0       1.0    > 0 start in expert mode
CROWDED          -1.0       2.0    = 1 => allow plots with all
                                          polarizations and IFs
                                   = 2 => use memory grid to
                                          do plots
DO3COLOR         -1.0       2.0    > 0 => do CROWDED with
                                   multiple colors =2 always
ANTUSE            0.0      90.0    Initial displayed antennas
BADDISK          -1.0      1000.0  Disks to avoid for scratch.
----------------------------------------------------------------
SNEDT
Type:  Task
Use:   To edit calibration table data interactively. The chosen
       observable (gain amplitude, phase, delay, or rate from SN/CL
       taBles or Tsys from TY tables or Pgain or Pdif, Psum, and their
       ratio from SY tables) for an antenna is displayed as a function
       of time in an edit window on the TV.  You may view the entire
       time range or select more detailed time ranges interactively.
       Optionally, under control of adverb DOTWO, a second SN/CL/TY/SY
       observable for the same antenna may be displayed over the same
       time range in a window above the edit window.  Data in the
       primary observable for 0 to 10 other antennas may displayed
       over the same time range in windows above these on the TV
       screen.  This display is controlled interactively.  A menu-like
       control interface is available to select the data antenna and
       time range to be edited and to select various forms of editing.
       An "expert mode" allows you to enter single-letter menu
       selections from the keyboard (xterm) while this expert mode is
       enabled.

*****            See EDITA to edit uv data based           ********
*****            on SN/CL/TY/SY-table values               ********

Adverbs:
  INNAME.....Input UV data file (name).       Standard defaults.
  INCLASS....Input UV data file (class).      Standard defaults.
  INSEQ......Input UV data file (seq. #).     0 => highest.
  INDISK.....Input UV data file disk drive #. 0 => any.
  INEXT......Table type: TY (system temperature), SY (EVLA SysPower),
             SN (gain solution), and CL (calibration) are supported.
             The task will use the TANT columns of a TY table if they
             are valid and will use the TSYS columns otherwise.  FILLM
             writes the TANT columns with more-or-less calibrated
             antenna temperatures for data taken after May 1996.  SY
             tables are provide with EVLA data - at least data read
             from the ASDM by obit (e.g. with BDF2AIPS).  The
             CalDevice (CD) table is also used to provide the Tcals.
                Input file type: 'CL', 'TY', 'SY' or anything else
                =>  'SN'
  INVERS.....Input file version number, 0 -> current highest.
             Output is always current highest + 1.
  DODELAY....> 0 AND <= 1.5 => use delays and rates as well as
                      amplitudes and phases in the displays and editing
                      process (for CL and SN)
             > 1.5 => use multi-band delays (only) in the displays and
                      editing process (for CL and SN)
                      NOTE: MB delays are used by astrometric solving
                      tasks not in AIPS.  They are written into SN
                      tables by FRING when APARM(5)=1 but do not
                      differ from the single-band delays written into
                      all IFs.  FRING with APARM(5)=2 does a separate
                      solution for MB and SB delays and different
                      values will appear in the columns then.  MBDLY
                      will take phases from FRING with APARM(5)=0
                      (separate SB delays) and fit an MB delay which
                      it adds to the SN table.
             > 2.5 => use dispersion only in the displays and editing
                      process.  Dispersion may be computed by KRING or
                      FRING and is most important at the lowest
                      frequencies.
             <=  0 => do not display or edit upon delays and rates
  TIMERANG...Time range of the data to be edited. In order:
             Start day, hour, min. sec, end day, hour, min. sec. Days
             are relative to the reference date.
  BIF........The lowest numbered IF to include.   0 => 1.
  EIF........The highest numbered IF to include. 0 =>highest.
             Note: not all data sets will have IFs.
  ANTENNAS...A list of antenna numbers to include.  0 => all.
  FREQID.....Frequency ID to edit.  0 => 1, -1 => all.  This is not
             recommended since you will not be able to tell them apart
             and they are likely to look different.
  SUBARRAY...Subarray number to edit.  0 => 1.
  FLAGVER....If > 0, apply FG table FLAGVER to the table data.
             Default here is to ignore any FG tables.
  SOLINT.....Samples within SOLINT (minutes) of the first sample in each
             time interval will be considered part of that interval,
             i.e., times with SOLINT of each other are treated as equal.
             0 => 1/6000 (i.e. 0.01 sec) which is fine in most cases.
  DETIME.....Samples more than DETIME (minutes) from the previous will
             be considered to imply a break in the time sequence and
             will be assigned a time interval after a gap of intervals
             or 2 intervals if the sample is more than 2 * DETIME later.
             < SOLINT => max (2, 5 * SOLINT) minutes.
  DOTWO......> 0 (true) means to do the secondary plot of a second
             observable (amplitude, phase, rate, delay) from the
             primary antenna.  <= 0 means to plot only the primary
             observable used for the editing.  True is recommended.
  EXPERT.....> 0 => the task begins in "expert mode" in which commands
             are entered with single characters at the keyboard rather
             than by TV menu selection.  You can switch in and out of
             expert mode interactively after the task begins without
             regard for the value of EXPERT.  If the task begins in
             EXPERT mode, it starts with the amplitudes plotted from 0
             to maximum, phases from -180 to 180, delays from -1000 to
             1000 ns and rates from -1000 to 1000 mHz and with the
             ALL IF and ALL POL flags = .NOT.CROWDED rather than
             false.  These choices may be changed interactively.
  CROWDED....If = 1, the task will be allowed to plot and edit all IFs
             and/or all polarizations at once.  Otherwise, only one
             polarization and one IF are plotted at a time and much of
             the editing is based only on the values of that
             polarization/IF.
  DO3COLOR...If CROWDED > 0 and DO3COL > 0, use 3 grey-scale image
             planes to plot the data in colors so as to differentiate
             between IFs and polarizations.  When one IF and
             polarization is plotted, the graphics plane is used
             unless DO3COL > 1.5.
             If = 2, the plots will be constructed in dynamic memory
             and then loaded as images rather than being drawn directly
             to the TV.  Use this if there are a lot of times and/or
             IFs being over-plotted to save time.
  ANTUSE.....Lists the antennas to appear in the initial display:
             antenna ANTUSE(1) is the initial edit antenna and
             ANTUSE(2) through ANTUSE(11) are the comparison antennas.
             The default is equivalent to ANTUSE=1,2,3 (or whatever
             are the 3 lowest numbered antennas).
  BADDISK....This array contains the numbers of disks on which it is
             desired that scratch files not be located.
------------------------------------------------------------------------

     SNEDT is a TV graphic editor for SN, CL, TY, and SY tables.  It
works with the XAS-TV display graphics planes (6 of them) to allow you
to flag and/or smooth the entries in an SN, CL, TY, or SY table.  It
does not change the input table; it makes a copy of the input and
edits that.  SNEDT does NOT take into consideration any relationship
between the solution for one antenna at a given time and those for the
other antennas at that time.  Similarly, SNEDT ignores the
relationships between delay, rate, and phase.  If you do something to,
say, phase, you should probably do the same thing to delay and rate
(if appropriate) to avoid loss of coherence for cross-hand
polarization data.  All functions below may be applied either to the
current IF or (sometimes) all IFs, to the current antenna or all
antennas, and to the current polarization or both polarizations.  It
is up to you to chose which of these are appropriate and which are not.

     SNEDT attempts to read the entire table into dynamic memory when
it starts up.  If it cannot fit all the data, it attempts to read just
one IF at a time.  In that case, when you switch IFs, SNEDT has to
write the previous IF back to disk as it reads in the next IF.  This is
both a bit slower and means that you cannot undo changes to one IF after
switching to another IF.  SNEDT will tell you as it starts whether "All
data will reside in memory" or "Will do only one IF in memory at a
time".  The SWITCH ALL IF option will not appear in the latter case.

     There are 5 parts to SNEDT's display:
(1) A menu of operations displayed in two columns, one each at the left
and right sides of the screen.  When the menu is displayed, move the
cursor to the desired item and press buttons A, B, or C.  To get on-line
help in the message window about a given option, move the cursor to the
desired menu item and press button D.
(2) A plot at the bottom of the screen in a bright color (usually) of
the data which may be actively edited at present.  It is of the chosen
type for the selected antenna, polarization(s), and IF(s) and is
limited in time range by the current frame (which can be all or a
portion of the total time range).  Flagged data are shown in a
different color.  The time range of the frame may be made small to
expand the time axis, but may also be made so large as to cause
serious crowding of the plotted data points.  (Increase your XAS
window width to increase the plot scale.)
(3) A plot above the edit area plot in the same bright color of the data
from the selected antenna, polarization(s), and IF(s).  This plot is
in a second observable (e.g. if amplitude is in the edit plot, phase
is often the second observable).  For TY tables, there is only one
observable, but "Tdif" is computed from the TY values and acts as a
second observable.  Tdif is Tsys/<T> - 1 where <T> is the average of
Tsys over a "scan" time surrounding the sample.  Data in this second
area may not be used for editing but should be helpful in choosing
which data to delete in the edit area.  Flagged data are shown in a
different color.  This plot may be suppressed by adverb DOTWO.
(4) 0-10 plots of data of the current data type, polarization(s), and
IF(s) for a list of 0-10 other antennas are shown above the second
plot.  They are shown for comparison using another color, while
flagged data are shown in a different color.
(5) Several text areas also appear including (a) the start and end times
for the current frame's time axis, (b) the selected data type, IF, and
polarization at the bottom of the screen, (c) the antenna shown in each
plot at the top right of each plot, (d) the current smoothing function
and all-IF, all-polarization, and all-antenna flags, (e) the y-axis tick
values on each of the frame plots, and (f) while interactively setting
time and/or value ranges, the time and/or value to which you are
currently pointing.

     You may change the size of the XAS window at any time.  SNEDT will
not allow it to become too small, but will adjust its display for all
reasonable sizes.

     For SN/CL tables, the left-hand menu can contain
-------------------
| FLAG TIME       |  To delete one time at a time.
| FLAG TIME RANGE |  To delete one or more time ranges.
| FLAG BELOW      |  To delete all displayed times with data below a
                        cutoff value.
| FLAG ABOVE      |  To delete all displayed times with data above a
                        cutoff value.
| FLAG AREA       |  To delete one or more areas in the data-value -
                        time plane.
| FLAG POINT      |  To delete one sample at a time using both
                        horizontal and vertical cursor position.
| FLAG QUICKLY    |  To delete samples using only mouse clicks
| RESTORE TIME    |  To un-flag one time at a time.
| RESTORE AREA    |  To un-flag one or more areas in the data-value -
                        time plane.
| SMOOTH TIME RNG |  To apply the smoothing function to one or more time
                        ranges
| REREAD TIME RNG |  To restore one or more time ranges from disk,
                        undoing the current editing and smoothing.
| ENTER SMOOTH PS |  To select the type and parameters of the smoothing.
| ENTER AMPL RNG  |  To select the display range for amplitude plots.
                        Use 0 -1 for 0 to antenna maximum and
                        0 0 for min to max.
| ENTER PHASE RNG |  To select the display range for phase plots.
| ENTER DELAY RNG |  To select the display range for delay plots.
| ENTER RATE RNG  |  To select the display range for rate plots.
| USE EXPERT MODE |  To control the task from the keyboard instead of
                        the menu.
| HOLD TV LOAD    |  To stop updating the TV display with every change
                        of parameter; change several, then select
| DO TV LOAD      |  To update the TV display now and with each change
                        of display parameter.
| REPLOT          |  To do the current plot over again
| EXIT            |  To exit SNEDT, writing the data back to the output
                        table.
| ABORT           |  To exit SNEDT, deleting the output table.
-------------------

     For SN/CL tables, the right-hand menu can contain
-------------------
| NEXT POL/IF     |  To switch to viewing the next correlator,
                        switching to the other polarization and, if
                        needed, incrementing the IF.
| SWITCH POLARIZ  |  To switch to viewing and editing the other
                        polarization (can cycle through all).
| SWITCH ALL POL  |  To switch functions from applying to one
                        polarization to applying to both polarizations
                        or vice versa.
| ENTER IF        |  To select which IF is viewed and edited.  This can
                        cause the current IF to be written to disk if
                        all IFs did not fit in memory.  0 -> all.
| SWITCH ALL IF   |  To switch functions from applying to one IF, to
                        applying to a range of IFs, or to applying to
                        all IFs (in sequence).
| SWITCH ALL TIME |  To switch FLAG ABOVE and FLAG BELOW between all
                        times and the time range of the frame
| SWITCH ALL SOURC|  To switch between flagging the current source and
                        flagging all sources.
| SWITCH ALL ANT  |  To switch functions from applying to one antenna to
                        applying to all antennas or vice versa.
| ENTER ANTENNA   |  To select the antenna to be displayed at the top
                        and in the edit area and to be edited.
| ENTER OTHER ANT |  To select up to 10 other antennas to be displayed;
                        enter only the ones you want including none
| NEXT ANTENNA    |  To select an antenna one higher than the currently
                        selected antenna
| PLOT ALL TIMES  |  To display and edit data for all times.
| SELECT FRAME    |  To select a window into the current data
                        interactively.
| NEXT FRAME      |  To select the next time range window.
| PREVIOUS FRAME  |  To select the previous time range window.
| TV ZOOM         |  To alter the display zoom used while in the flag,
                        restore, smooth and re-read functions.
| OFF ZOOM        |  To turn off any zooming.
| SHOW AMPLITUDE  |  To display and edit amplitudes.
| SHOW PHASE      |  To display and edit phases.
| SHOW DELAY      |  To display and edit delays.
| SHOW RATE       |  To display and edit rates.
| SHOW ALSO AMPL  |  To display amplitudes in the secondary window.
| SHOW ALSO PHASE |  To display phases in the secondary window.
| SHOW ALSO DELAY |  To display delayss in the secondary window.
| SHOW ALSO RATE  |  To display rates in the secondary window.
-------------------

     For TY tables, the left-hand menu can contain
-------------------
| FLAG TIME       |  To delete one time at a time.
| FLAG TIME RANGE |  To delete one or more time ranges.
| FLAG BELOW      |  To delete all displayed times with data below a
                     cutoff value.
| FLAG ABOVE      |  To delete all displayed times with data above a
                     cutoff value.
| FLAG AREA       |  To delete one or more areas in the data-value -
                     time plane.
| FLAG POINT      |  To delete one sample at a time using both
                        horizontal and vertical cursor position.
| FLAG QUICKLY    |  To delete samples using only mouse clicks
| RESTORE TIME    |  To un-flag one time at a time.
| RESTORE AREA    |  To un-flag one or more areas in the data-value -
                     time plane.
| SMOOTH TIME RNG |  To apply the smoothing function to one or more time
                     ranges
| REREAD TIME RNG |  To restore one or more time ranges from disk,
                     undoing the current editing and smoothing.
| ENTER VALUES    |  To enter new values for Tsys from the terminal.
| ENTER SMOOTH PS |  To select the type and parameters of the smoothing.
| ENTER TSYS RNG  |  To select the display range for Tsys plots.
| ENTER TDIF RNG  |  To select the display range for Tdif plots.
| SET SCAN LENGTH |  To enter the length of a "scan" in seconds for
                        computing Tdif = Tsys/<T> - 1.
| USE EXPERT MODE |  To control the task from the keyboard instead of
                        the menu.
| HOLD TV LOAD    |  To stop updating the TV display with every change
                     of parameter; change several, then select
| DO TV LOAD      |  To update the TV display now and with each change
                     of display parameter.
| REPLOT          |  To do the current plot over again (recomputes Tdif)
| EXIT            |  To exit SNEDT, writing the data back to the output
                     table.
| ABORT           |  To exit SNEDT, deleting the output table.
-------------------

     For TY tables, the right-hand menu can contain
-------------------
| NEXT POL.IF     |  To switch to viewing the next correlator,
                        switching to the other polarization and, if
                        needed, incrementing the IF.
| SWITCH POLARIZ  |  To switch to viewing and editing the other
                        polarization (can cycle through all).
| SWITCH ALL POL  |  To switch functions from applying to one
                        polarization to applying to both polarizations
                        or vice versa.
| ENTER IF        |  To select which IF is viewed and edited.  This can
                        cause the current IF to be written to disk if
                        all IFs did not fit in memory.  0 -> all.
| SWITCH ALL IF   |  To switch functions from applying to one IF to
                        applying to all IFs or vice versa.
| SWITCH ALL TIME |  To switch FLAG ABOVE and FLAG BELOW between all
                        times and the time range of the frame
| SWITCH ALL SOURC|  To switch between flagging the current source and
                        flagging all sources.
| SWITCH ALL ANT  |  To switch functions from applying to one antenna to
                        applying to all antennas or vice versa.
| ENTER ANTENNA   |  To select the antenna to be displayed at the top
                        and in the edit area and to be edited.
| ENTER OTHER ANT |  To select up to 9 other antennas to be displayed;
                        enter 9 numbers, 0's are then ignored.
| NEXT ANTENNA    |  To select an antenna one higher than the currently
                        selected antenna
| PLOT ALL TIMES  |  To display and edit data for all times.
| SELECT FRAME    |  To select a window into the current data
                     interactively.
| NEXT FRAME      |  To select the next time range window.
| PREVIOUS FRAME  |  To select the previous time range window.
| SHOW TSYS/<T>-1 |  To display and edit with Tdif.
| SHOW TSYS       |  To display and edit Tsys.
| TV ZOOM         |  To alter the display zoom used while in the flag,
                        restore, smooth and re-read functions.
| OFF ZOOM        |  To turn off any zooming.
-------------------

     For SY tables, the left-hand menu can contain
-------------------
| FLAG TIME       |  To delete one time at a time.
| FLAG TIME RANGE |  To delete one or more time ranges.
| FLAG BELOW      |  To delete all displayed times with data below a
                     cutoff value.
| FLAG ABOVE      |  To delete all displayed times with data above a
                     cutoff value.
| FLAG AREA       |  To delete one or more areas in the data-value -
                     time plane.
| FLAG POINT      |  To delete one sample at a time using both
                        horizontal and vertical cursor position.
| FLAG QUICKLY    |  To delete samples using only mouse clicks
| RESTORE TIME    |  To un-flag one time at a time.
| RESTORE AREA    |  To un-flag one or more areas in the data-value -
                     time plane.
| SMOOTH TIME RNG |  To apply the smoothing function to one or more time
                     ranges
| REREAD TIME RNG |  To restore one or more time ranges from disk,
                     undoing the current editing and smoothing.
| ENTER VALUES    |  To enter new values for Tsys from the terminal.
| ENTER SMOOTH PS |  To select the type and parameters of the smoothing.
| ENTER PDIF RNG  |  To select the display range for Pdif (Pon-Poff)
                        plots.
| ENTER PSUM RNG  |  To select the display range for Psum (Pon+Poff)
                        plots.
| ENTER PGAIN RNG |  To select the display range for PostGain plots.
| ENTER TSYS RNG  |  To select the display range for power sum divided
                        by Power difference / 2 * Tcal (= Tsys) plots.
                        Use 0 -1 for 0 to antenna maximum and 0 0 for
                        min to max.
| ENTER PD/P RNG  |  To select the display range for plots of the
                        difference between Pdif and its running average
                        divided by the average.
| ENTER PS/P RNG  |  To select the display range for plots of the
                        difference between Psum and its running average
                        divided by the average.
| ENTER PG/P RNG  |  To select the display range for plots of the
                        difference between Pgain and its running average
                        divided by the average.
| ENTER TS/T RNG  |  To select the display range for plots of the
                        difference between Psum/Pdif/2*Tcal (= Tsys)
                        and its running average divided by the average.
| SET SCAN LENGTH |  To enter the length of a "scan" in seconds for
                        computing PD = Pdif/<Pdif> - 1 and the ones
                        for Psum and PSum/Pdif/2*Tcal.
| USE EXPERT MODE |  To control the task from the keyboard instead of
                        the menu.
| HOLD TV LOAD    |  To stop updating the TV display with every change
                        of parameter; change several, then select
| DO TV LOAD      |  To update the TV display now and with each change
                        of display parameter.
| REPLOT          |  To do the current plot over again (recomputes Tdif)
| EXIT            |  To exit SNEDT, writing the data back to the output
                        table.
| ABORT           |  To exit SNEDT, deleting the output table.
-------------------

     For SY tables, the right-hand menu can contain
-------------------
| NEXT POL/IF     |  To switch to viewing the next correlator,
                        switching to the other polarization and, if
                        needed, incrementing the IF.
| SWITCH POLARIZ  |  To switch to viewing and editing the other
                        polarization (can cycle through all).
| SWITCH ALL POL  |  To switch functions from applying to one
                        polarization to applying to both polarizations
                        or vice versa.
| ENTER IF        |  To select which IF is viewed and edited.  This can
                        cause the current IF to be written to disk if
                        all IFs did not fit in memory.  0 -> all.
| SWITCH ALL IF   |  To switch functions from applying to one IF to
                        applying to all IFs or vice versa.
| SWITCH ALL TIME |  To switch FLAG ABOVE and FLAG BELOW between all
                        times and the time range of the frame
| SWITCH ALL SOURC|  To switch between flagging the current source and
                        flagging all sources.
| SWITCH ALL ANT  |  To switch functions from applying to one antenna to
                        applying to all antennas or vice versa.
| ENTER ANTENNA   |  To select the antenna to be displayed at the top
                        and in the edit area and to be edited.
| ENTER OTHER ANT |  To select up to 9 other antennas to be displayed;
                        enter 9 numbers, 0's are then ignored.
| NEXT ANTENNA    |  To select an antenna one higher than the currently
                        selected antenna
| PLOT ALL TIMES  |  To display and edit data for all times.
| SELECT FRAME    |  To select a window into the current data
                     interactively.
| NEXT FRAME      |  To select the next time range window.
| PREVIOUS FRAME  |  To select the previous time range window.
| SHOW PDIF       |  To display and edit power differences (Pon-Poff)
| SHOW PSUM       |  To display and edit power sums (Pon+Poff)
| SHOW PGAIN      |  To display and edit power post gains (Pgain)
| SHOW TSYS       |  To display and edit Psum/Pdif/2*Tcal = Tsys
| SHOW PDIF/<P>-1 |  To display and edit the differences between
                        power difference and its running mean
| SHOW PSUM/<P>-1 |  To display and edit the differences between
                        power sum and its running mean
| SHOW PGAIN/<P>-1 |  To display and edit the differences between
                        Pgain and its running mean
| SHOW TSYS/<T>-1 |  To display and edit the differences between
                        Psum/Pdif/2*Tcal = Tsys and its running mean
| SHOW ALSO PDIF  |  To display power differences (Pon-Poff) in
                        the secondary window.
| SHOW ALSO PSUM  |  To display power sums (Pon+Poff) in the
                        secondary window.
| SHOW ALSO PGAIN |  To display power post gains in the secondary
                        window.
| SHOW ALSO TSYS  |  To display Psum/Pdif/2*Tcal = Tsys in the
                        secondary window.
| SHOW ALSO DPDIF |  To display the difference between the power
                        difference and its running mean in the
                        secondary window.
| SHOW ALSO DPSUM |  To display the difference between the power
                        sum and its running mean in the secondary
                        window.
| SHOW ALSO DPGAIN |  To display the difference between the power
                        post gain and its running mean in the
                        secondary window.
| SHOW ALSO DTSYS |  To display the difference between Psum/Pdif/2
                        * Tcal = Tsys and its running mean in the
                        secondary window.
| TV ZOOM         |  To alter the display zoom used while in the flag,
                        restore, smooth and re-read functions.
| OFF ZOOM        |  To turn off any zooming.
-------------------

     The menus will not show all of these options every time.  The HOLD
TV LOAD option is shown until invoked, and then is replaced with the DO
TV LOAD.  When that is invoked, the HOLD TV LOAD option reappears.  The
DELAY and RATE options appear only if the DODELAY adverb was true.  The
SWITCH POLARIZ and SWITCH ALL POL options appear only if there are two
polarizations in the SN/CL/TY/SY table.  The ENTER IF option appears
only if there is more than one IF in the table and the SWITCH ALL IF
option appears only if there is more than one IF and all IFs fit in
the program memory.  The only SHOW and SHOW ALSO options to appear are
for those not already displayed.

     The smoothing functions are based on two windows on the time axis.
The cursor is used to set a time-range (t1-t2) to be smoothed.  Data
from t1-W to t2+W, where W is the smoothing function window, are passed
into a smoothing routine and the results used to replace the samples in
the t1 through t2 range.  The functions are:

(1) 2PT   Replace datum at time t, if flagged, with the linearly
          interpolated value of the nearest sample above t and below t
          but within W/2 of t.
(2) 2PTH  Replace datum at time t with the average of the datum itself
          and the linearly interpolated value of the nearest sample
          above t and below t, but within W/2 of t.
(3) BOX   Replace datum at time t with the average of all data within
          W/2 of t.
(4) MWF   Replace datum at time t with the median of all data within
          W/2 of t.
(5) GAUS  Replace datum at time t with the weighted average of all data
          samples within W/2 of t, using a Gaussian function of
          abs(time-t) of FWHM of W2.
(6) EXO   Replace datum at time t with the weighted average of all data
          samples within W/2 of t, using a Exponential function of
          abs(time-t) of FWHM of W2.
(7) LINE  Replace datum at time t with the weighted average of all data
          samples within W/2 of t, using a linear function of
          abs(time-t) of FWHM of W2.

The ENTER SMOOTH PS asks you 2 or 3 questions: the first to set the type
which is case-insensitive but must be left justified, the second to set
W in integer seconds, and the third, if needed, to set the full-width at
half maximum for the Gaussian and linear weighting functions.  The
smoothing is done across all sources.  For TY tables it is done on the
Tsys.  For SY tables it is done simultaneously on the Pdif, Psum, and
Pgain.  The ratio of Psum/Pdif/2*Tcal is recomputed as well.  This
allows the flagging to be handled correctly.  For SN/CL tables, the
smoothing is done only on the currently displayed parameter.  It has
the undesirable attribute that the flagging of the other parameters is
lost even though they are not smoothed.  Unfortunately, one probably
wants to smooth amplitude and phase solutions rather differently
making this a feature rather than a correctable bug.

     Note that value-dependent flagging (FLAG BELOW, ABOVE, AREA) use
the values currently plotted to decide what to delete.  You need also to
be careful with the SWITCH ALL ANT setting with these value-dependent
commands.  If one antenna is set, then the commands only apply to the
current antenna.  If all antennas is set, the commands apply to all
antennas.  The first two set a clip level, below or above which data are
deleted, based on the value of the observable in each antenna
independently.  The FLAG AREA command, however, only looks at the values
of the observable in the main edit antenna and flags those samples from
all applicable antennas

     Be careful when choosing EXIT versus ABORT.  The former leaves the
new and modified SN or CL table attached to the input uv data, the
latter causes the new and modified table to disappear without a trace.
After EXIT, of course, one may use, edit, or ignore the output SN or CL
table.

     The colors used by SNEDT are those of the various graphics planes
when it begins to run.  You may change them with the AIPS verb GWRITE to
more desirable colors.  The planes are:
   Plane     Default RGB      Use
     1     1.00  1.00  0.00   Main editing and secondary windows
     2     0.06  1.00  0.00   Comparison antenna data windows
     3     1.00  0.67  1.00   Menu highlight
     4     0.00  1.00  1.00   Edit and frame window boundaries
     5     1.00  0.18  0.18   Flagged data in all windows
     6     0.60  0.60  1.00   Menu foreground
     7     1.00  0.80  0.40   unused
You may wish to change the colors to ones that you can see better.
When CROWDED and DO3COL are invoked together, TV channels 14-16 are
used for a 3-color display to help you see which IF/polarization is
which.  The colors range from red to blue starting with IF BIF,
polarization 1, then polarization 2, then IF 2 polarization 1, and so
on.  When you select a single IF and polarization, graphics plane 1 is
used unless you set DO3COL > 1.5.  In that case each correlation is
plotted in its unique color whether in a single display or a crowded
one.  When displaying one IF and two polarizations, the colors are
chosen so that polarization 1 appears in a red/orange color and
polarization 2 in a green/blue color.

     In "expert" mode, you are prompted with a set of 4-character codes.
You type in the letter within that code that is shown in upper case
(left-justified with a carriage return) to get the desired function.
The expert functions allowed for SN/CL tables are

      Code  Prompt  Full menu OP name
         T   Time   FLAG TIME
         R   Rang   FLAG TIME RANGE
         B   Belo   FLAG BELOW
         A   Abov   FLAG ABOVE
         E   arEa   FLAG AREA
         O   pOin   FLAG POINT
         Q   Quik   FLAG QUICKLY
         C   nCor   NEXT POL/IF
         N   Nant   NEXT ANTENNA
         F   Fram   SELECT FRAME
         M   aMpl   SHOW AMPLITUDE
         P   Phas   SHOW PHASE
         D   Dely   SHOW DELAY
         S   Srat   SHOW RATE
         X   eXit   EXIT EXPERT MODE
         H   Help   THIS HELP LIST

For TY tables they are

      Code  Prompt  Full menu OP name
         T   Time   FLAG TIME
         R   Rang   FLAG TIME RANGE
         B   Belo   FLAG BELOW
         A   Abov   FLAG ABOVE
         E   arEa   FLAG AREA
         O   pOin   FLAG POINT
         Q   Quik   FLAG QUICKLY
         C   nCor   NEXT POL/IF
         N   Nant   NEXT ANTENNA
         F   Fram   SELECT FRAME
         S   tSys   SHOW TSYS
         D   tDif   SHOW TDIF
         X   eXit   EXIT EXPERT MODE
         H   Help   THIS HELP LIST

For SY tables they are

      Code  Prompt  Full menu OP name
         T   Time   FLAG TIME
         R   Rang   FLAG TIME RANGE
         B   Belo   FLAG BELOW
         A   Abov   FLAG ABOVE
         E   arEa   FLAG AREA
         O   pOin   FLAG POINT
         Q   Quik   FLAG QUICKLY
         C   nCor   NEXT POL/IF
         N   Nant   NEXT ANTENNA
         F   Fram   SELECT FRAME
         S   pSum   SHOW PSUM
         D   pDif   SHOW PDIF
         G   pGai   SHOW PGAIN
         Y   tsYs   SHOW TSYS
         X   eXit   EXIT EXPERT MODE
         H   Help   THIS HELP LIST

although some may be suppressed depending on what is currently
displayed.
------------------------------------------------------------------------
