; HLPSCMAP
;---------------------------------------------------------------
;! Cleaning tasks  - internal help
;# TASK AP IMAGING OOP CALIBRATION INTERACTIVE TV-APPL VLBI
;-----------------------------------------------------------------------
;;  Copyright (C) 1995-1997, 2000, 2015
;;  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
;-----------------------------------------------------------------------
C-----------------------------------------------------------------------
OFFZOOM
This option resets any zoom factors and zoom center.  The image is
actually shown in zoom only when the menu selection is not going on.
Thus, the image is zoomed during cursor-value, Black-and-white and color
enhancement and window and box setting.
C-----------------------------------------------------------------------
OFFTRANS
This option turns of any black-and-white enhancements done in TVFIDDLE
or TVTRANSF.
C-----------------------------------------------------------------------
OFFCOLOR
This options turns of any color enhancements done in TVFIDDLE, TVPSEUDO,
or TVFLAME.  Has no effect if the image is in black and white.
C-----------------------------------------------------------------------
TVFIDDLE
This option allows you to set the zoom factor and center to blow up the
data plot for more accurate cursor positioning.  It also allows you to
alter the look-up-tables.  Button A selects image enhancement, altering
between black-and-white and the AIPS-standard color contours.  Button B
increments the zoom or resumes zoom-center mode, while button C
decrements the zoom or resumes zoom-center mode.  Button D ends the
enhancing and returns to the menu.  Instructions appear on the message
screen.
C-----------------------------------------------------------------------
TVTRAN
This option allows you to set the black-and-white transfer function
using the TV cursor to control intercept and slope.  Buttons A and B
turn a plot of the LUT on and off, button C reverses the sign of the
slope, and button D ends the enhancement and returns to the menu.
Instructions appear on the message screen.
C-----------------------------------------------------------------------
TVPSEUDO
This option allows you to set the color transfer function using the TV
cursor.  Button A loops through all possible RGB triangles, button B
selects a circle in hue (which is very useful for phase displays),
button C selects several color contours, and button D ends the
enhancement and returns to the menu.  As in AIPS, the TV cursor is used
to adjust the colors within the selected function.  Instructions appear
on the message screen.
C-----------------------------------------------------------------------
TVFLAME
This option allows you to set the color transfer function using the TV
cursor and a flame-like color scheme.  Buttons A and B cycle through the
sequence of all possible color combinations, while buttons C and D end
the enhancement and return to the menu.  The TV cursor X position
adjusts the image intensity at which the color turns more white, while
the Y position adjusts the way colors add (the gamma).  Instructions
appear on the message screen.
C-----------------------------------------------------------------------
TVZOOM
This option lets you set the TV zoom magnification factor and to set the
point about which the zoom takes place.  The cursor points at the zoom
center which will be  shifted to the center of the screen.  A hit on
buttons A or B increments the magnification factor and on button C
decrements the magnification factor in a circular fashion.  Hit button D
to exit.  Instructions appear on the message screen.
C-----------------------------------------------------------------------
CURVALUE
To perform an interactive display of the pixel locations and values of
the image visible on the TV.  The X and Y pixel coordinates, the pixel
value, and the units of the pixel value are displayed in TV graphics
channels 3 and 4 at the upper left of the display.  The cursor position
determine which pixel is shown.  Button D ends the display and returns
to the menu.  Instructions appear on the message screen.  The pixel
values are read from disk and hence preserve accuracy.
C-----------------------------------------------------------------------
SET WINDOW
This option allows you to set the visible window into the current field.
It must encompass all Clean boxes and the TV loading procedure will
choose pixel increments large enough to load the full image window.  You
may wish to use a smaller window - if it includes all Clean boxes - in
order to use smaller pixel increments and hence to see more detail.
This option is similar to TVWINDOW in AIPS.  Any button marks the BLC on
the image, switching you to setting TRC.  Thereafter, buttons A and B
switch between setting BLC and TRC and buttons C and D set the window,
reload the image and return to the menu.  Instructions appear on the
message screen.  Note that the cursor position cannot be moved off the
currently visible image window.
C-----------------------------------------------------------------------
RESET WINDOW
This option lets you set the visible window into the current field to
include the whole field.  The image will be redisplayed using pixel
increments large enough to fit the full image into the TV memory (you
may have to increase the XAS window size to see it all - use F2).  You
may wish to do this to see the full image and/or to set a larger window
or larger Clean boxes than were available to you with the previous
window.
C-----------------------------------------------------------------------
TVBOX
This option lets you create up to 256 or more (up to 2048 if there are
fewer than 64 fields) Clean boxes to restrict the search for components
in the current field.  The boxes may be circular or rectangular.  While
setting the lower left corner (or circle center) of each box for the
first time, button A or B will mark the point and switch to setting the
upper right corner (or radius) of the box.  Button C will switch
between setting a rectangle and setting a circle and button D will
delete the current partial box and return to the menu.  While setting
the upper right corner (or radius) re-setting the lower left or center,
button A marks the current point (corner, center, or radius) and
switches to the opposite point (e.g. BLC <-> TRC, center <-> radius).
Button B marks the current point and switches to the next (new) box,
button C marks the current point and switches to a search mode leading
to the resetting of a previous box, and button D exits.  In search mode,
move the cursor to any lower left or upper right corner of any already
set rectangular box (or any center or any place on the circumference of
an already set circular box) and press button A or B to reset that
point or push button C to go on to the next box or button D to go back
to the menu.  The number of boxes is set by this function.  Instructions
appear on the message screen and the TV cursor cannot be moved to make
a box extend beyond the (full) TV window.  NOTE: function REBOX may be
used to reset the results if needed.  TVBOX deletes all pre-existing
boxes so, if there are any, it now asks permission to do so.  If you do
not answer Y or y, REBOX will be done instead.
C-----------------------------------------------------------------------
REBOX
This option lets you create up to 256 or more (up to 2048 if there are
fewer than 64 fields) Clean boxes to restrict the search for components
in the current field.  The boxes may be circular or rectangular.
Unlike TVBOX, REBOX begins by displaying any current Clean boxes and
then goes into the search mode to revise the current Clean boxes.  While
setting the lower left corner (or circle center) of each box for the
first time, button A or B will mark the point and switch to setting the
upper right corner (or radius) of the box.  Button C will switch between
setting a rectangle and setting a circle and button D will delete the
current partial box and return to the menu.  While setting the upper
right corner (or radius) re-setting the lower left or center, button A
marks the current point (corner, center, or radius) and switches to the
opposite point (BLC <-> TRC, center <-> radius).  Button B marks the
current point and switches to the next (new) box, button C marks the
current point and switches to a search mode leading to the resetting of
a previous box, and button D exits.  In search mode, move the cursor to
any lower left or upper right corner of any already set rectangular box
(or any center or any place on the circumference of an already set
circular box) and press button A or B to reset that point or push
button C to go on to the next box or button D to go back to the menu.
The number of boxes is set by this function.  Instructions appear on the
message screen and the TV cursor cannot be moved to make a box extend
beyond the (full) TV window.  NOTE: function REBOX may be used to reset
the results if needed.
C-----------------------------------------------------------------------
EDIT DATA
This option selects an interactive editing tool (also found in task
EDITR) to display and edit the visibility and residual data.  You may
view up to 10 baselines to your selected antenna at a time and view
(and edit upon) the visibility amplitude or phase or the amplitude or
phase of the difference between the visibility and a running vector mean
of the visibility.  A considerable menu of editing and display options
is available; press button D on each item to obtain help on it.  A
warning: it takes a while to load the data into the editor.  Therefore,
you should not select this option too freely.  Performance may be helped
some by time averaging in the editing phase with adverb APARM(9).
C-----------------------------------------------------------------------
SET PARAMETERS
Since SCMAP is run as an interactive task, TELLing it to change
parameters requires a second AIPS session and some care.  This option
brings up a question and answer session that prompts you for all TELL
parameters plus a couple other useful ones.  Answer with a blank line
(simple carriage return) to leave the parameter unchanged; answer with a
Q or q to stop the questioning.  The parameters are, in order, NMAPS,
DOTV, SOLINT, APARM(10), NITER, APARM(9), APARM(8), FLUX, GAIN, FACTOR,
MINPATCH, MAXPIXEL, BMAJ, BMIN, BPA, REFANT, WTUV, SOLTYPE, SOLMODE,
SOLCON.  If SOLMODE is already A&P due to a switch from P, do not change
it.  Note that APARM(9) is the averaging time when editing data and
APARM(8) is controls the level of components used in the self-cal
solution and Clean restart (as APARM(8) * image rms).  APARM(10) is the
amplitude smoothing interval.  DOTV values of 1 (do all TV displays), -1
(do only self-cal TV display), and 0 (do neither display --- not
recommended since you then need a TELL from somewhere to turn the TV
back on).
C-----------------------------------------------------------------------
SWITCH TO A&P
This option, when displayed, allows you to switch from phase-only to
amplitude and phase self-cal.  The option is displayed until the switch
is done and then only if SOLMODE=' ' at the beginning.  SCMAP applies
the latest phase calibration to the input data moving them to another
file.  Then it doubles the SOLINT and does the remaining self-cals as
A&P.  If you want to ignore the previous phase cals (other than by their
effect on the current Clean image), use SET PARAMETERS and change
SOLMODE instead.
C-----------------------------------------------------------------------
CONTINUE SELFCAL
This option allows you to resume the current Self-cal operation without
waiting for the time-out interval to expire.
C-----------------------------------------------------------------------
STOP SELFCAL
This option allows you to request that the current Selfcal operation be
declared complete at this point.  A deep clean will then be done,
followed by a restoration of the components to the residual images (if
requested) and the output images will be written.
C-----------------------------------------------------------------------
TURN OFF TV
Turns off the option to display and interact with the residual images at
the end of each Clean - i.e. before doing the next self-cal.  This
option may be turned on again only with TELL SCMAP from AIPS.
C-----------------------------------------------------------------------
ABORT TASK
This option allows you to terminate SCMAP as rapidly as possible with an
abnormal termination condition.
C-----------------------------------------------------------------------
