This Section is a brief guide for the user who wants to modify an existing task in or to write a new task.
While it is difficult to write an
task from scratch,
contains several template tasks that are designed to
hide most of the work from the “occasional” programmer. Anyone familiar with FORTRAN and a little of the
system services of their local computer should be able to add convenient tasks to their local version of
with
a little practice and patience. The growing use of binary installations makes this more difficult since local sites are
unlikely to have the relevant compilers.
The simplest way to write an task is to modify one of the four template tasks, TAFFY, CANDY, FUDGE,
OFUDG, or UVFIL. These tasks handle the
I/O, contain extensive documentation, need to be
modified in only a few well-defined places, and can be easily interfaced to user subroutines. They are
limited in their ability to handle many input and output images, however, and generally operate on
one image row or one visibility point at a time. Softening of these limitations will be discussed in
§12.6.5.
TAFFY — This template task reads an existing image in line by line, modifies the line of data as desired and
then creates and writes the modified image in
. This template task might, for example, be used to blank pixels
in an input image in some specified manner.
CANDY — This task is similar to TAFFY except the input data are contained in an auxiliary file which is FORTRAN
readable and outside . The task can transfer an image in any reasonable format outside
into the
data structure.
FUDGE — This template task reads an existing uv database optionally applying calibration, editing, and data
selection, modifies the results point by point, and then creates and writes this modified output uv database in the
catalog. This template task might, for example, be used to modify a uv data base for which the time
parameter has been incorrectly written. OFUDG is an older version of FUDGE which omits all the complications of the
calibration system.
UVFIL — This task is similar to FUDGE without calibration and editing, except that the input uv data are contained in
one or two auxiliary files, which are FORTRAN readable and outside . The task is useful for translating
visibility data in an arbitrary format into an
cataloged uv data set, or for computing a uv data set from
model sources.
If you wish to make a minor change in an existing task, it will be simpler to copy the
task itself and
modify it as needed. For example, if you wanted to add a option in COMB to combine two input images in a new way
to obtain a resultant image, it would be better to start with COMB itself than with one of the templates. However,
non-trivial changes to major tasks will require a careful look at the code, which is generally well documented and
segmented.
Changes to tasks that make plots and/or use the TV and other graphics devices can be tricky, but are useful
sometimes. Changes to imaging and deconvolution software should not be attempted unless the changes are
almost trivial. Modifying existing verbs or creating new ones require you to find which AUxx.FOR routine is
involved and then require the entire AIPS program to be re-linked. Going describes some of the
considerations. The new pseudo-verbs VERB and PSEUDOVB allow you to update your AIPS vocabulary using
your own procedure rather than by changing the supplied vocabulary files and executing POPSGN as
described in Going
. In all cases, do not put your modified code into the standard
code
areas unless your local
Manager agrees and has made a backup copy of the original code and
executables. Such modified files may well disturb the
updates done by the so-called “Midnight
Job.”
Even if you have special privileges in , it is wise to generate and link new code in your own user directory
rather than in your installation’s designated local
directory. After the code has been written and tested,
check with your local
Manager about installing it in a public area. Decide which template task or
other
task you want to modify, then follow these instructions after logging into your private
area.
Under Unix
% source /AIPS/LOGIN.CSH C R | to get the basic |
% . /AIPS/LOGIN.SH C R | to get the basic |
% $CDTST (or $CDNEW) C R | to set up the logical assignments for programming. |
% LIBS $AREA > NTASK.OPT C R | to create a file of linking information for a task found in area AREA, e.g., APLPGM for OFUDG and TAFFY, APGNOT for FUDGE, CANDY and UVFIL, YPGM for IMEAN, etc. |
to copy code for TASK into your area and to give it a new name (≤ 5 letters). |
% cp $HLPFIL/TASK.HLP NTASK.HLP C R | to copy and rename the inputs/help file for the task. |
% setenv MYAIPS ‘pwd‘ C R | to define MYAIPS (must be uppercase) as your disk area for
|
% export MYAIPS=‘pwd‘ C R | to define the MYAIPS environment variable under korn, bash, and bourne shells. |
Before modifying the task in any way, it is wise to compile, link and execute the unchanged task to check that the
original code is sound and that all of the logical assignments have been properly set. The duplicated
task should run identically to the original; the template tasks are set up to duplicate the input data set
with no changes and default parameters. In this way errors or other problems associated with the
generation of new tasks can be found and corrected before getting into the quagmire of bugs that you are
about to add. Note that CANDY and UVFIL require external data files and are therefore not so easily
checked.
One change is needed in the FORTRAN program before checking. In the main program, about 60 lines down, there is a data statement which identifies the task.
Change this to
DATA PRGM /’NTASK’/ |
|
The maximum number of characters in a task name is five and the DATA statement must be in the above form. There is no need to change the help file yet, as long as it is named NTASK.HLP.
To compile and link the task, type:
% COMLNK NTASK NTASK.OPT C R |
|
To compile the task for debugging, add the DEBUG NOOPT options to the COMLNK line. There should be no error messages and no significant warnings.
After successful compilation and linking, try executing the task. Under Unix, stay logged in to your area. To initiate the AIPS program, type:
% aips C R | or |
% aips debug C R | to use the debugger (e.g., dbx) on tasks compiled with the DEBUG option. You will have to tell the procedure which debugger you want and that you do not want to start AIPS itself under that debugger. |
Your Manager may have to make some arrangements for you to activate
from your login. Once you
have started
, type
> VERSION ’MYAIPS’ C R | to specify the location of inputs and help information and of the task executable. |
Set up the input parameters, then
> INP C R | to review the input parameters. You should be told AIPS 1: Found in Version=MYAIPS at the start of the inputs display. If not, there is something wrong with the logical or task name or the location of the inputs/help file. |
> GO C R | to run the task. The Found … line should appear again. |
If you are modifying an existing task, the only ground rules are to read the task carefully and note the locations
where changes must be made. Unlike the template tasks which are organized so that additional code need be
inserted in only one or two places, an task may need revisions in a variety of places. Some guidelines
are:
The template tasks are:
These tasks are described in detail in Chapter 2 of Going . The template tasks and the code for each are
extensively documented there, so only the major points are discussed here.
TAFFY reads a selected subset of an image, one row at a time, to a user interface subroutine DIDDLE. An output image is created, cataloged and filled with values calculated in DIDDLE (or attached subroutines). The dimensionality of the output image need not be the same as the input image.
CANDY lets you create an image one row at a time. Input information is obtained through a file which is external to
.
OFUDGE reads an existing uv database point by point and creates a new uv database with the modified data. It can easily be used to make simple changes in a uv database; for example, if the u, v, or w terms are to be recalculated, if all phases are to be changed in sign, etc. FUDGE does the same but with the full set of calibration, flagging, source selection, etc. adverbs.
UVFIL reads input from one or two FORTRAN-readable files which are outside to create, catalog, and fill a
uv database into
. This task is useful for transcribing uv data in an arbitrary format into an
database.