AIPS NRAO AIPS HELP file for SPFLG in 31DEC24



As of Mon Oct 14 8:16:28 2024


SPFLG: edit multi-channel UV data using TV display and cursor

INPUTS

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
ANTENNAS                           Antennas to include
BASELINE                           Baselines with ANTENNAS
UVRANGE           0.0              UV range in kilolambda
SUBARRAY          0.0     1000.0   Subarray,   0 => 1
                                   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 total-power
                                       <2 include cross-power
                                          [see HELP file]
                                   (3)
                                   (4) >0 => divide by source
                                       flux, = 2 include
                                       spectral index, =3 incl
                                       curvature
                                   (5) Expand time ranges by
                                       DPARM(5) in sec
                                   (6) y-axis interval: give the
                                       sample time in seconds.
                                       default = 10 seconds.
                                   (7)
                                   (8) initial relative baseline
                                       # displayed; 0 => 1, can
                                       choose interactively
                                   (9,10) pixrange for initial
                                       TV load - can reset later
                                       interactively
DOCENTER                           > 0 -> center the grey-scale
                                   in the TV, else avoid menu
BADDISK                            Disks to avoid for scratch
                                   and for master grid file.

HELP SECTION

SPFLG
Type:  Task
Use:   Grids UV data of the selected type to form an image.  SPFLG will
       work on single- and multi-source files in TB sort order.  It
       grids the data with channel # 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, SPFLG displays the
       grid on the TV smoothing the data in time and showing every n'th
       pixel in channel as needed to fit the display.  Then, SPFLG
       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)!
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.
  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.
             The task will warn you if you end up using a pre-existing
             grid file but it cannot test most adverb values.
  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 calibrator code:
                '    '  =>  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', 'LR', 'VV', 'HH',
             'VH', or 'HV' for a single polarization or use 'IV', 'QU',
             'HALF', 'RLLR', or, 'VHHV for two  polarizations as
             separate planes in the master grid.  To have more than 2
             planes in the master grid enter 'FULL', 'IQU', or 'IQUV'.
             '    ', 'RRLL', and 'VVHH' 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 (or VV, VH, and HV) while leaving LL (HH)
             unflagged. For LL or HH displayed, '0111' is the default.
             Strings 'NORR' ('NOVV') and 'NOLL' ('NOHH') will now be
             taken as '0111' and '1011', respectively.  Note that the
             Stokes flag pattern does not change when you switch
             interactively between the Stokes in your data.  You will be
             warned if the new Stokes is not in your flag pattern.
                        ------------------------
  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.  IFs are now gridded along with
             spectral channels in one longer horizontal axis.
             If this is undesirable, run SPFLG 1 IF at a time.
             This is only a little more painful than the previous
             treatment of each IF as a separate cube in the grid.
  EIF........Highest IF to grid.    0 => highest.
  BCHAN......First channel to grid in X axis.   0 => 1.
  ECHAN......Last channel to grid.  0 => highest.
  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;
             BASELINE=6,8.
  UVRANGE....Range of projected spacings to be gridded in 1000's of
             wavelengths.  0  =>  1, 1.E10
  SUBARRAY...Subarray number to grid.      0 => 1.
             The task can handle only one subarray at a time.
  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).
  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
             corrected.
             (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
             corrected.
  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
               SMOOTH(2).
  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 => total-power data are included if present
                 < 2 => cross-power data are included if present
                 NOTE: DPARM(2)=2 displays *ONLY* total-power spectra
                      [see EXPLAIN file]
             (3) not used
             (4) <= 0 => grid amplitudes as found in data set
                 > 0 => divide amplitudes by source flux
                 = 2 => include spectral index in the source flux
                        division
                 = 3 => include spectral index and curvature in the
                        source flux division
             (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)
             (8) initial baseline to display; any baseline may be
                 selected interactively.  The baseline axis contains
                 points only for those baselines which have data.  A TB
                 table is attached to the cataloged master grid file
                 listing them.  The baseline displayed on the TV is
                 listed in the line(s) at the bottom of the menu.
             (9,10) PIXRANGE to use for initial TV load of the type
                 given in DPARM(1).  All three pix ranges may be set
                 interactively.
  DOCENTER...> 0 => display the grey-scale approximately at the center
                    of the TV window even if this makes it overlap the
                    menu.
             <= 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).

EXPLAIN SECTION

     SPFLG has three main steps:
(1) Grid the data to a master grid with channels/IFs 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 irregular.
(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
    process.
(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, Stokes, baselines, etc.) to ensure that the
operation is truly complete.  Breaking your data set up into smaller
pieces will speed such operations greatly without compromising the
editing.  This is now less inportant as computers have become more
capable.

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
| LIST BASLS |   list antenna pairs by baseline "number"
| SET REASON |   enter reason to be attached to flagging commands
| DO LABEL ? |   turns on/off axis labeling
| CHAR MULT  |   To change character size (only if character scale
                 is, or is by default, larger than 1)

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
selected.

The next to 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 channel 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 baseline
number may be typed in.  Flagging may be done only for the current
baseline and IF and source, or it may be done for all baselines 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 rms to the TV
| ENTER R/M PIXRANGE |   Type in the value range to be used for loading
                         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
                         size
| ENTER BASELINE     |   To enter a desired antenna pair using the
                         terminal or the baseline number and a zero
| 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
                         displayed.
| ENTER CH SMOOTH    |   To type in the FWHM of a Gaussian smoothing
                         in spectral channels in the data type being
                         loaded.
| 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 SPFLG
                         flagged. The former is desirable when a time
                         range encompasses all of 2  calibrator scans.
| SWITCH BASLIN FLAG |   To rotate the pointer that selects which
                         baselines are flagged.  It starts at n-m
                         where n and m are the 2 antennas, then n-*,
                         then m-*, then *-*, then n-m, etc., where
                         * means all.  Applies to subsequent flagging.
| 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-IF flag remains true if the input data set has no more than one
IF and the all-source flag remains true if the file has only one source.

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
follows:
     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.  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 scalar 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
                         average"
| 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
                         adverb).
| 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 BASELINE |   Reload TV with the current parameters and the
                         previous baseline in sequence.
| LOAD NEXT BASELINE |   Reload TV with the current parameters and the
                         next baseline in sequence.
| LOAD LAST PIECE    |   Load the previous overlapping piece of the
                         data
| 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 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.
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 Channel-T
| FLAG TIME RANGE    |   To flag all channels for a range of times
| FLAG CHANNEL-DT    |   To flag a channel for a range of times
| FLAG TIME          |   To flag all channels for a specific time
| FLAG A CHANNEL     |   To flag all times for a specific channel
| FLAG CHANNEL RANGE |   To flag all times for a range of channels
| 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 baselines using the "method"
                         and clipping range of some previous clip
                         operation.

The last operation allows you to apply a clipping method already used on
one baseline to other baselines and/or Stokes.  CLIP BY FORM asks for a
command number (use LIST FLAGS) and applies its display type (amp,
phase, rms, rms/mean), averaging interval and clip levels to a range of
baselines and Stokes (as entered from the terminal).  To terminate the
operation, doing nothing, enter a letter instead of one of the
requested baseline 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, SPFLG asks the user whether or
not he actually wishes to do this.  You must respond yes or no.

When the menu is displayed, a status lines are also displayed on the TV
to show the averaging time, corners, baseline, 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 SPFLG 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.

SPFLG 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, SPFLG 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 may be prepared
to flag 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.

As mentioned above, the building of the SPFLG master file can be a
lengthy process.  In the case of the VLBA correlator, flagging can
productively be broken into a two stage process.  First, one examines
only the total-power spectra.  This should be used to identify all
station based problems in the data.  SPFLG will load quickly, run a
bit faster, and be less tedious to go through since there are only N
baselines to examine [for an N station experiment].  Second, one
examines [read should examine here] all cross power baselines.  This
should reveal no new problems, except where the correlator itself
corrupts the data.  As the correlator is more fully checked out, it is
expected that all flags should be identifiable by examining only the
Total-power spectra.


AIPS