As of Sat Jan 20 7:33:04 2018

TVFLG: Task to edit UV data using the TV display and cursor


INNAME                             UV data (name).
INCLASS                            UV data (class).
INSEQ             0.0    9999.0    UV data (seq. #).  0 => high
INDISK                             Disk unit #.       0 => any
DOCAT            -1.0       2.0    Catalog work file ?
IN2SEQ            0.0              Sequence number of work file
IN2DISK                            Disk number of work file
DOHIST          -10.0       1.0    Record flags in history file
SOURCES                            Source list
CALCODE                            Calibrator code '    '=>all
TIMERANG                           Time range to include
STOKES                             Stokes type to display
SELBAND                            Bandwidth to select (kHz)
SELFREQ                            Frequency to select (MHz)
FREQID                             Freq. ID to select.
BIF               0.0      100.0   Lowest IF number 0=1
EIF               0.0      100.0   Highest IF number
BCHAN             0.0     2048.0   Lowest channel number 0=>1
ECHAN             0.0     2048.0   Highest channel number
NCHAV                              Number of chan. to average.
CHINC                              Channel incr. between maps.
ANTENNAS                           Antennas to include
BASELINE                           Baselines with ANTENNAS
UVRANGE           0.0              UV range in kilolambda
SUBARRAY          0.0     1000.0   Subarray, 0 => all, but the
                                   task is more efficient doing
                                   one at a time
                                   Cal. info for input:
DOCALIB          -1.0      101.0   > 0 calibrate data & weights
                                   > 99 do NOT calibrate weights
GAINUSE                            CAL (CL or SN) table to apply
DOPOL            -1.0       10.0   If >0 correct polarization.
PDVER                              PD table to apply (DOPOL>0)
BLVER                              BL table to apply.
FLAGVER                            Flag table version 0 => high
                                      < 0 no flagging on input
                                      Used w single-source too
OUTFGVER          0.0              Output FG table version
DOBAND           -1.0       10.0   If >0 apply bandpass cal.
                                   Method used depends on value
                                   of DOBAND (see HELP file).
BPVER                              Bandpass table version
SMOOTH                             Smoothing function. See
                                   HELP SMOOTH for details.
DPARM                              Control info:
                                   (1) 0=amp, 1=phase, 2=rms,
                                       3=rms/mean for initial
                                       display, can choose any
                                       interactively later
                                   (2) > 0 include autocorr data
                                   (3) >0 = baseline as ant pair
                                       for B as x-axis only
                                   (4) >0 => divide by source
                                       IPOL flux
                                   (5) Expand time ranges by
                                       DPARM(5) in sec
                                   (6) y-axis interval: give the
                                       sample time in seconds.
                                       default = 10 seconds.
                                   (7) initial IF displayed, 0
                                       => BIF, can choose BIF -
                                       EIF interactively
                                   (8) initial channel displayed
                                       0 => BCHAN, can choose
                                       BCHAN - ECHAN later
                                   (9,10) pixrange for initial
                                       TV load - can reset later
DOCENTER                           > 0 -> center the grey-scale
                                   in the TV, else avoid menu
BADDISK                            Disks to avoid for scratch
                                   and for master grid file.


Type:  Task
Use:   Grids UV data of the selected type to form an image.  TVFLG will
       work on single- and multi-source files in TB sort order.  It
       grids the data with Baseline on the X axis and Time on the Y
       axis.  All samples falling into a cell are averaged by vector
       averaging.  After making this "master" grid, TVFLG displays the
       grid on the TV smoothing the data in time and showing every n'th
       pixel in baseline as needed to fit the display.  Then, TVFLG
       displays its interactive options: fiddle colors and contrast,
       change zoom, set windows (and reload the new subimage with less
       time smoothing), and select cells to flag.  This last is, of
       course, the main function.  The grid file may be cataloged and
       kept for more than one session of interactive editing.  All
       commands to flag data are written to a special FC extension to
       the master grid file.  As a result, they are not lost when the TV
       hangs up, the power fails, the program aborts, or the user exits
       the program willingly.  Commands in the FC file may be deleted
       and their effects on the master grid file undone.  The actual
       flagging of the uv data set is done at the end of all interactive
       operations at the users' command.  Flag tables are written for
       multi-source files and, optionally, for single-source files.  The
       uv data may be flagged directly for single-source files that do
       not already have a flag table.  The latter can be very slow, but
       there are a few tasks that do not honor flag tables.  We
       recommend creating flag tables nonetheless and using SPLIT to
       apply the tables directly to the data when needed.  Note that the
       cataloging of the master grid with its FC file means that one can
       apply the editing commands to more than one UV file (with
       caution, of course)!
  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.
  DOCAT......True (>0) means to use a cataloged file for the master
             grid.  It creates a new one or uses an old one, depending
             on the value of IN2SEQ.  If DOCAT = 2 and IN2SEQ = 0, then
             the program returns to the user immediately, prepares the
             cataloged master grid file, and then exits.  The program
             must be rerun with an appropriate, non-zero value of IN2SEQ
             to flag the data.  This option allows the user to do other
             things while creating a large master grid file.  IN2DISK is
             used for cataloged master grid files with BADDISK  used for
             scratch and, if IN2DISK = 0, cataloged master grid files.
  IN2SEQ.....Sequence number of cataloged master grid file.  0 => create
             new one, else use existing one of seq number = IN2SEQ.
             NOTE: to use this option, all of the adverbs must have the
             same value as when the old grid file was created.
  IN2DISK....Disk number of cataloged work file.  0 => use any disk for
             pre-existing file and any disk not listed in BADDISK
             (independent of DOCAT) to create a new cataloged file.
             Ignored when DOCAT <= 0.
  DOHIST.....> 0 => record task execution and flagging info in the
             history file (this can be a lot!).  <= 0.0 means to omit
             the flagging info and < -9.5 means to omit the execution
             information as well.
  SOURCES....List of sources to be gridded. '  '=> all; if any starts
             with a '-' then all except ANY source named.
  CALCODE....Sources may be selected on the basis of the calibrator
                '    '  =>  any calibrator code selected
                '*   '  =>  any non blank code (cal. only)
                '-CAL'  =>  blank codes only (no calibrators)
                anything else = calibrator code to select.
  TIMERANG...Time range of the data to be gridded. In order:
             Start day, hour, min., sec, end day, hour, min.,
             sec. in days relative to reference date.
  STOKES.....The desired Stokes type of the gridded and displayed data.
             Use 'I','Q','U','V','RR','LL', 'RL', or 'LR' for a single
             polarization or use 'IV', 'QU', 'HALF', 'RLLR' for two
             polarizations as separate planes in the master grid.
             To have >2 planes in the master grid enter 'FULL', 'IQU',
             or 'IQUV'.  '    ' and 'RRLL' are taken as 'HALF'.
             Anything else => 'HALF' or 'I' depending on what
             polarizations the correlators themselves have.
             NOTE: the default STOKES FLAG setting, i.e. the set of
             polarizations (correlators) to be flagged when you begin
             is controlled by what polarization is first displayed.
             Thereafter, you may enter interactively any desired set
             including all those above any pattern at all as a set of
             4 1's and 0's.  These masks cause any correlator marked
             with a 1 in the mask to be flagged.  For example, if RR
             is displayed, the default mask is '1011' and flags RR,
             RL, and LR while leaving LL unflagged. For LL displayed,
             '0111' is the default.  Strings 'NORR' and 'NOLL' will
             now be taken as '0111' and '1011', respectively.  Note
             that the Stokes flag pattern does not change when you
             switch interactively between the 2 Stokes in your data.
             You will be warned if the new Stokes is not in your flag
  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, 0=> all
  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, 0=> all
  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.
  BIF........Lowest IF to grid.  IF will be axis 4.
             NOTE to VLA users: IF=1 corresponds to the VLA
             AC ifpairs and IF=2 corresponds to the BD ifpairs.
  EIF........Highest IF to grid.    0 => highest.
  BCHAN......First channel to grid in axis 3.   0 => 1.
  ECHAN......Last channel to grid.  0 => highest.
  NCHAV......NCHAV is the number of channels to be averaged together
             in in the gridding process.  0 => 1.  If this value is
             less than the total number of channels, then the flagging
             will offer multiple planes of baseline versus time.  Note
             that all spectral planes will include data from NCHAV
             input channels so the actual ECHAN used may be less than
             that specified (or in the data set).  NOTE: when
             restarting with an existing work file, NCHAVG must be
             given correctly.  CHINC, BCHAN, and ECHAN may be deduced
             from the work file header, only if NCHAVG is specified
  CHINC......Number of input channels to skip between images. 0 => 1
             The i'th spectral plane includes input channels
                 BCHAN + (i-1)*CHINC
                 MIN (ECHAN, BCHAN + (i-1)*CHINC + NCHAV - 1).
             CHINC is ignored in NCHAV >= ECHAN-BCHAN+1.
  ANTENNAS...A list of the antennas to grid.  If any number is negative
             then all antennas listed are NOT desired and all others
             are.  All 0 => grid all.
  BASELINE...Baselines are specified for inclusion using BASELINE. Eg.
             baselines 1-6,1-8, 2-6 and 2-8 use ANTENNAS=1,2;
  UVRANGE....Range of projected spacings to be gridded in 1000's of
             wavelengths.  0  =>  1, 1.E10
  SUBARRAY...Subarray number to grid.     0 => all.
             If you have multi-source data with more than one source at
             a single time increment, then you will need to specify the
             SUBARRAY and do one of them at a time.  NOTE: the task is
             more efficient if you do the subarrays one at a time in any
  DOCALIB....If true (>0), calibrate the data using information in the
             specified Cal (CL) table for multi-source or SN table for
             single-source data.  Also calibrate the weights unless
             DOCALIB > 99 (use this for old non-physical weights).
             MUST be false for single-source data in BT order.
  GAINUSE....Version number of the Cal. table to apply to the data if
             DOCALIB=1.  Refers to a CL table for multi-source data or
             an SN table for single-source.   0 => highest.
  DOPOL......If > 0 then correct data for instrumental polarization as
             represented in the AN or PD table.  This correction is
             only useful if PCAL has been run or feed polarization
             parameters have been otherwise obtained.  See HELP DOPOL
             for available correction modes: 1 is normal, 2 and 3 are
             for VLBI.  1-3 use a PD table if available; 6, 7, 8 are
             the same but use the AN (continuum solution) even if a PD
             table is present.
  PDVER......PD table to apply if PCAL was run with SPECTRAL true and
             0 < DOPOL < 6.  <= 0 => highest.
  BLVER......Version number of the baseline based calibration (BL)
             table to appply. <0 => apply no BL table, 0 => highest.
  FLAGVER....Specifies the version of the flagging table to be applied.
             0 => highest numbered existing FG table.  <0 => no
             flagging to be applied on input.
  OUTFGVER...Flag table version to be used on output for both single-
             and multi-source data sets.  If OUTFGVER is <= 0 or
             greater than FGmax (the previously highest FG version
             number), then a new FG table will be created for the new
             flags with version FGmax+1.  This new table will also
             contain the flags applied on input (if any) from FG
             version FLAGVER.  If OUTFGVER specifies a pre-existing FG
             version, then the input flags are not copied even if
             OUTFGVER and FLAGVER are not equal.
  DOBAND.....If true (>0) then correct the data for the shape of the
             antenna bandpasses using the BP table specified by BPVER.
             The correction has five modes:
             (a) if DOBAND=1 all entries for an antenna in the table
             are averaged together before correcting the data.
             (b) if DOBAND=2 the entry nearest in time (including
             solution weights) is used to correct the data.
             (c) if DOBAND=3 the table entries are interpolated in
             time (using solution weights) and the data are then
             (d) if DOBAND=4 the entry nearest in time (ignoring
             solution weights) is used to correct the data.
             (e) if DOBAND=5 the table entries are interpolated in
             time (ignoring solution weights) and the data are then
  BPVER......Specifies the version of the BP table to be applied.
             0 => highest numbered table. <0 => no bandpass correction
             to be applied.
  SMOOTH.....Specifies the type of spectral smoothing to be applied to
             a uv database . The default is not to apply any smoothing.
             The elements of SMOOTH are as follows:
             SMOOTH(1) = type of smoothing to apply: 0 => no smoothing
               To smooth before applying bandpass calibration
                 1 => Hanning, 2 => Gaussian, 3 => Boxcar, 4 => Sinc
               To smooth after applying bandpass calibration
                 5 => Hanning, 6 => Gaussian, 7 => Boxcar, 8 => Sinc
             SMOOTH(2) = the "diameter" of the function, i.e. width
               between first nulls of Hanning triangle and sinc
               function, FWHM of Gaussian, width of Boxcar. Defaults
               (if < 0.1) are 4, 2, 2 and 3 channels for SMOOTH(1) =
               1 - 4 and 5 - 8, resp.
             SMOOTH(3) = the diameter over which the convolving
               function has value - in channels.  Defaults: 1,3,1,4
               times SMOOTH(2) used when input SMOOTH(3) < net
  DPARM......Control info:
             (1) used only to set initial choice of the type of
                 information to be gridded and displayed: 0 =>
                 amplitude, 1 => phase, 2 => RMS of amplitude, 3 => RMS
                 of amplitude / mean of amplitude.
             (2) > 0 => autocorrelation data are included if present;
                 else they are excluded.
             (3) controls how "baseline number" is computed
                <= 0 => normal baselines (1-2, 1-3, ... 1-N,
                        2-3, 2-4, ... 2-N, 3-4, ...)
                 > 0 => as antenna pair gridding each sample
                        twice (1-2, 1-3, ... 1-N, 2-1, 2-3,
                        ... 2-N, 3-1, 3-2, ... 3-N, ...)
             (4) <= 0 => grid amplitudes as found in data set
                 > 0 => divide amplitudes by source flux
             (5) When the time ranges used inside TVFLG are applied to
                 external data - either directly or through a FG
                 table they are expanded by DPARM(5) seconds in each
                 direction.  If there has been averaging of data in
                 the input data to TVFLG or by TVFLG and the
                 resultant flags are to be applied to an unaveraged
                 data set, then this option should be used to avoid
                 leaving out some of the samples that contributed to
                 the averages.  <0 => 0.
             (6) time interval on Y axis of master grid: units are
                 seconds, default = 10.  More time averaging will be
                 done later under the user's interactive control - so
                 make this the most basic integration time under most
                 circumstances (except very short VLB samples).
             (7) initial IF to display; any IF may be selected
                 interactively from BIF through EIF
             (8) initial channel to display; any channel may be selected
                 interactively from BCHAN through ECHAN
             (9,10) PIXRANGE to use for initial TV load of the type
                 given in DPARM(1).  All three pix ranges may be set
  DOCENTER...> 0 => display the grey-scale approximately at the center
                    of the TV window even if this makes it overlap the
             <= 0 => display the grey-scale to the right of most of
                    the menu if at all possible.
  BADDISK....Disk number(s) to avoid for scratch files AND, if IN2DISK
             is zero, for the master disk file
             (independent of DOCAT).


     TVFLG has three main steps:
(1) Grid the data to a master grid with baseline on the x axis and time
    on the y axis.  The cell size in time is set by the user (DPARM(6))
    and data falling in the same cell are vector averaged.  This master
    grid saves the real and imaginary parts of the visibility separately
    along with a flag number for each visibility.  The master grid will
    not be completely regular in its times.  No more than 4 blank rows
    will appear and different sources cannot be in the same row.  Thus
    the y axes in the master grid (and in the TV grid) will be somewhat
(2) The interactive session(s) in which the user selects data to be
    flagged and alters the TV display of the data to assist in the
(3) The actual flagging of the data and writing of the history file.  A
    flag table is written for multi-source files and the uv data
    themselves are flagged for single-source files.
All steps may be done in a single execution.  However, if DOCAT is used,
then they may be done in several sessions.

Most operations on the master grid are relatively efficient and
reference only small parts of that file.  However, some read and write
the whole file (all times, IFs, channels, etc.) to ensure that the
operation is truly complete.  Breaking your data set up into smaller
pieces (say by doing one IF at a time) will speed such operations
greatly without compromising the editing.

The interactive session is driven by a menu which is displayed on the TV
graphics screen.  Move the cursor to the desired operation (noting that
the currently selected one is highlighted in a different color on many
TVs) and press any button to select the operation.  The first (left-most
column) of choices is:

| OFFZOOM    |   turn off any zoom magnification
| OFFTRANS   |   turn of any black & white enhancement
| OFFCOLOR   |   turn of any pseudo-coloring
| TVFIDDLE   |   as in AIPS, allows zoom, pseudo-color contours or black
                 and white enhancement
| TVTRANSF   |   black and white enhancement as in AIPS
| TVPSEUDO   |   many pseudo-colorings as in AIPS
| DO WEDGE ? |   switches choice of displaying a step wedge
| LOAD xxxx  |   switch TV load transfer function to xxxx
| LIST FLAGS |   list selected range of flag commands
| UNDO FLAGS |   remove flags by number from FC table and from
                 the master grid
| REDO FLAGS |   reapply all flags to master grid
| SET REASON |   enter reason to be attached to flagging commands
| DO LABEL ? |   turns on/off axis labeling

Note: when a flag is undone, all cells in the master grid which were
first flagged by that command are restored to use.  Flag commands done
after the one that was undone may also, however, have applied to some of
those cells.  To check this and correct any improperly unflagged pixels,
use the REDO FLAGS option.  This option even redoes CLIP operations!
After an UNDO or REDO FLAGS operation, the TV is automatically reLOADed
if needed.  Note that the UNDO operation is one that reads and writes
the full master grid.

The load to the TV for all non-phase displays may be done with all
standard transfer functions: LINear, LOG, SQRT, LOG2 (more extreme
log).  The menu shows the next one in the list through which you may
cycle.  The TV is reloaded immediately when a new transfer function is

The last option in Column 1 offers the ability to customize the reason
given for each flagging command in the FG table.  Before flagging,
this option should be chosen to enter a character string (<24 char)
which will be used as the reason for all flagging commands, until this
option is chosen again.  The default reason to use is 'SPFLG: date
time' where the date and time is the date and time at which the
flagging commands were entered into the FG table.  Note: the list of
flagging reasons built up during one session with SPFLG is not saved
for the next invocation, even if a work-file is requested.

Column 2 offers type-in controls of the TV display and controls of which
data are to be flagged.  In general, the master grid will be too large
to display on the TV screen in its entirety.  The program begins by
loading every n'th baseline and time smoothing by m time intervals in
order to fit the full image on the screen.  However, you may select a
subwindow in order to see the data in more detail.  You may also control
the range of intensities displayed (like the adverb PIXRANGE in TVLOD
inside AIPS).  The averaging time to smooth the data for the TV display
may be chosen, as may the averaging time for the "scan average" used in
some of the displays.  Which correlators are to be flagged by the next
flagging command may be typed in.  All of the standard STOKES values,
plus any 4-bit mask may be entered (see HELP file above).  The spectral
channel and IF may be typed in.  Flagging may be done only for the
current channel and IF and source, or it may be done for all channels
and/or IFs and/or sources.  Note that these controls affect the next
LOADs to the TV or the flagging commands prepared after the parameter is
changed.  When the menu of options is displayed at the top of the TV,
the current selections are shown along the bottom.  If some will change
on the next load, they are shown with an asterisk following.

| ENTER BLC          |   Type in a BLC on the terminal
| ENTER TRC          |   Type in a TRC on the terminal
| ENTER AMP PIXRANGE |   Type in the intensity range to be used for
                         loading amplitude images to the TV
| ENTER PHS PIXRANGE |   Type in the phase range to be used for loading
                         phase images to the TV
| ENTER RMS PIXRANGE |   Type in the intensity range to be used for
                         loading images of the vector and scalar rms
                         to the TV
| ENTER R/M PIXRANGE |   Type in the value range to be used for loading
                         vector and scalar rms/mean images to the TV
| ENTER SMOOTH TIME  |   To enter the time smoothing length in units of
                         the master grid cell size
| ENTER SCAN TIME    |   To enter the time averaging length for the
                         "scan average" in units of the master grid cell
| ENTER CHANNEL     |    To enter the desired spectral channel number
                         using the terminal
| ENTER IF          |    To enter on the terminal the desired IF number
| ENTER STOKES FLAG  |   To type in the 4-character string which will
                         control which correlators (polarizations) are
                         flagged.  Note: this will apply only to
                         subsequent flagging commands. It should be
                         changed whenever a different Stokes is
| SWITCH SOURCE FLAG |   To switch between having all sources flagged by
                         the current flag commands and having only those
                         sources included in this execution of TVFLG
                         flagged. The former is desirable when a time
                         range encompasses all of 2 calibrator scans.
| SWITCH ALL-CH FLAG |   To reverse the flag all channel status.
                         Applies to subsequent flag commands.
| SWITCH ALL-IF FLAG |   To rotate the flag all IFs status from one IF
                         to a range of IFs, to all IFs.  Applies to
                         subsequent flag commands.

The all-channel flag remains true if the input data set has only one
channel and the all-IF flag remains true if the input data set has no
more than one IF.

An extra word should be said about the "scan average".  This is used
solely for displaying the difference of the data at time T and the
average of the data at times near T.  This average is computed with a
"rolling buffer".  Thus for a scan average time of 30 seconds and data
at 10 second intervals, the average for a set of 7 points is as
     time:        average of times:
       00           00   10   20
       10           00   10   20
       20           10   20   30
       30           20   30   40
       40           30   40   50
       50           40   50   60
       60           40   50   60

The third column of options is used to control which data are displayed
and to cause the TV display to be updated.  The master grid must be
converted from complex to amplitude or phase for display.  Using
either scalar or vector averaging, it may be converted to the rms of
the amplitude or the rms divided by the mean of the amplitude.  It may
also be converted to the amplitude of the vector difference between
the current observation and the "scan average" as defined above or the
absolute value of the difference in amplitude with the scalar-average
amplitude or the absolute value of the difference in phase with the
vector scan average. Furthermore, the baselines may be  reordered in the
TV display by their length rather than their numerical position. This
column has the options:

| DISPLAY AMPLITUDE  |   To display amplitudes on the TV
| DISPLAY PHASE      |   To display phases on the TV
| DISPLAY RMS        |   To display scalar amplitude rms on the TV
| DISPLAY RMS/MEAN   |   To display amplitude rms/mean on the TV
| DISPLAY VECT RMS   |   To display vector amplitude rms on the TV
| DISPLAY VRMS/VAVG  |   To display vector amplitude rms/mean on the TV
| DISPLAY AMP V DIFF |   To display the amplitude of the difference
                         between the data and a running (vector) "scan
| DISPLAY AMPL DIFF  |   To display the abs(difference) of the amplitude
                         of the data and a running scalar average of the
                         amplitudes in the "scan"
| DISPLAY PHASE DIFF |   To display the abs(difference) of the phase of
                         the data and the phase of a running (vector)
                         "scan average"
| DISPLAY STOKES xx  |   To switch to Stokes type xx (where xx can be
                         RR, LL, RL, LR, etc as chosen by the STOKES
| SORT BY xxxxxxxx   |   To switch to a display with the x axis
                         (baseline) sorted by ordered by LENGTH or by
                         BASELINE number
| OFF WINDOW + LOAD  |   Reset the window to the full image and reload
                         the TV
| SET WINDOW + LOAD  |   Interactive window setting (like TVWINDOW)
                         followed by reloading the TV
| LOAD LAST PIECE    |   Load the previous overlapping piece of the
| LOAD NEXT PIECE    |   Load the next overlapping piece of the data
| LOAD               |   Reload TV with the current parameters.

SET WINDOW + LOAD is "smarter" than TVWINDOW and will not let you set a
window larger than the basic image.  Therefore, if you wish to include
all pixels on some axis, move the TV cursor outside the image in that
direction.  The selected window will be shown.  LOAD NEXT CH/IF/ST
increments the current channel number.  If that exceeds the number of
spectral channels, it sets the channel number to BCHAN and increments
the current IF number.  If that exceeds the number of IFs, it sets the
IF to BIF and switches the polarization, possibly changing the Stokes
flag.  It then loads the newly selected data.  LOAD LAST PIECE and
LOAD NEXT PIECE appear only when there are too many times to fit on
the TV screen at the current smoothing parameter.  It lets you load
one piece at time in sequence.  The pieces will overlap somewhat.

The fourth column is used to select the type of flagging to be done.
It may also be used to load the previous or next spectral channel.
During flagging, a TV graphics plane is used to display the current
pixel much like CURVALUE in AIPS.  Buttons A and B do the flagging
(except A switches corners for the area and time range modes).  Button C
also does the flagging, but the program then returns to the main menu
rather than prompting for more flagging selections.  Button D exits back
to the menu without doing any additional flagging.  Another graphics
plane is used to show the current area/time/baseline being flagged.  All
flagging commands can create zero, one, two, or more entries in the
flagging list; hit button D at any time.  There are also two clipping
modes, an interactive one and one in which the user enters the clip
limits from the terminal.  In both, the current image computed for the
TV (with user-set windows and data type, but not any other windows or
alternate pixels etc. required to fit the image on the TV) is examined
for pixels which fall outside the allowed intensity range.  Flagging
commands are prepared and the master file blanked for all such pixels.
In the interactive mode, buttons A and B switch between setting the
lower and upper clip limits, button C causes the clipping to occur
followed by a return to the main menu, and button D exits to the menu
with no flagging.  The options are

| FLAG PIXEL       |  To flag single pixels
| FLAG/CONFIRM     |  To flag single pixels, but request a yes or no on
                      the terminal before proceding
| FLAG AREA        |  To flag a rectangular area in BT
| FLAG TIME RANGE  |  To flag all baselines for a range of times
| FLAG ANTENNA-DT  |  To flag all baselines to a specific antenna for a
                      range of times
| FLAG TIME        |  To flag all baselines for a specific time
| FLAG BASELINE    |  To flag all times for a specific baseline
| FLAG BASELINE-DT|   To flag a time range for a specific baseline
| CLIP BY SET #S   |  To enter from the terminal a clipping range for
                      the current mode and then clip
| CLIP INTERACTIV  |  To enter with the cursor and LUTs a clipping range
                      for the current mode and then clip the data.
| CLIP BY FORM     |  To clip selected channels/IFs using the "method"
                      and clipping range of some previous clip
| LOAD NEXT IF/ST  |  Load TV with next spectral IF or polarization
| LOAD NEXT CHAN   |  Reload the TV with the current parameters except
                      the next higher spectral channel
| LOAD PREV CHAN   |  Reload the TV with the current parameters except
                      the next lower spectral channel

The last two operations appear only when there is more than one
spectral channel in the flagging.  CLIP BY FORM allows you to apply a
clipping method already used on one channel/IF to other channels
and/or IFs.  It asks for a command number (use LIST FLAGS) and applies
its display type (amp, phase, rms, rms/mean, differences), averaging
and scan intervals and clip levels to a range of channels, IFs and
Stokes (as entered from the terminal). To terminate the operation,
doing nothing, enter a letter instead of one of the requested channel
or IF numbers.  To omit a Stokes, reply, if requested for a flag
pattern, with a blank line.  You may watch the operation being carried
out on the TV as it procedes.

The right-most column has only the option:

| EXIT |    Go resume AIPS and enter the flags in the data

Before the flags are entered in the data, TVFLG asks the user whether or
not he actually wishes to do this.  You must respond yes or no.

When the menu is displayed, one or more status lines are also
displayed on the TV to show the averaging time, corners, IF, Channel,
Stokes, etc. of the currently displayed data.  If these will change on
the next load, an asterisk is show after the values.

The building of the master file can be a lengthy process for large uv
data sets.  If you are going to run TVFLG more than once - WITH THE SAME
PARAMETERS - then use the DOCAT and IN2SEQ options to catalog the master
file during the first execution and to restart with that file in later
executions.  Note that DOCAT = 2 with IN2SEQ = 0, allows immediate
resumption of AIPS since no interactive flagging will be done.

TVFLG keeps track of the source name associated with each row of data.
When averaging to build the master grid and to build the displayed
grids, TVFLG will not average data from different sources and will
inform you that it has omitted data if it has had to do so for this
reason.  For multi-source files, the source name is displayed during the
CURVALUE-like sections.  However, the flagging table is prepared to flag
ALL one or ALL sources for the specified antennas, times, etc. depending
on the setting of the SOURCE flag.  If you end up with undesirable
results in the FG table, then you may have to use PRTAB, TABED or TAFLG
to correct the FG file.