Applications from Kappa and other packages can be combined in procedures and scripts to customise and automate data processing. In addition to giving literal values to application parameters, you can include ICL or C-shell variables on the command line, whose values are substituted at run time. It is also possible to write parameter data into variables, and hence pass them to another application, or use the variables to control subsequent processing.
The C-shell Cookbook contains many ingredients and recipes, and features many Kappa commands.
So there is little point repeating them here other than to direct you to a documented script in
$KAPPA_DIR/multiplot.csh
.
You should consult the ICL Users’ Guide for details about writing ICL syntax, procedures, and functions, but you’re a busy researcher…For a quick overview the two-page summary on “Writing ICL command files and procedures” in SUN/101 is recommended reading, even though much of the document is dated and still refers to VMS. Here we’ll just show some example procedures that can be adapted and cover points not mentioned in SUN/101.
Let’s start with something simple. You want to ‘flash’ a series of images, each with a yellow border.
First you write the following procedure called FLASH. It has one argument INPIC, that passes the
name of the NDF you want to display. When you substitute an ICLvariable for a parameter value you
enclose it in parentheses. The lines beginning with {
are comments.
To make ICL recognise your procedure you must ‘load’ it. The command
will load the file FLASH.ICL
. Thereafter in the ICL session you can invoke FLASH for many NDFs. The
following will display the NDFs called GORDON and FLOOD side-by-side.
It would be tedious to have to load lots of individual procedures, but you don’t. If you have related
procedures that you regularly require they can be concatenated into a single file which you load.
Better still is to add definitions for each of the procedures in your ICL login file. This is defined as the
value of the ICL_LOGIN
environment variable. A reasonable place is in your home directory and you’d
define it like this.
However, the file doesn’t have to be in your home directory, or called login.icl
, but it’s convenient to
do so. Suppose you have three procedures: FLASH, PICGREY in file $MY_DIR/display_proc.icl
, and
FILTER in /home/user1/dro/improc.icl
. In your $HOME/login.icl
you could add the
following
which defines three commands that will be available each time you use ICL: FLASH which will run your FLASH procedure, PICGREY to execute the PICGREY procedure, and SFILT which runs the FILTER procedure. In addition PICGREY can be abbreviated to PICGR or PICGRE. So now you can load and run your procedure. Let’s have some more example procedures.
Suppose you have a series of commands to run on a number of files. You could create a procedure to perform all the stages of the processing, deleting the intermediate files that it creates.
There is a piece of syntax to note which often catches people out. Filenames, data objects, and devices
passed via ICL variables to applications, such as NDFIN and NDFOUT in the above example, must be
preceded by an @
.
A common use of procedures is likely to be to duplicate processing for several files. Here is an example procedure that does that. It uses some intrinsic functions which look just like Fortran.
If NUM is set to 10, the above procedure obtains the statistics of the images named REDX1, REDX2, …REDX10. The ICL variable FILE is in parentheses because its value is to be substituted into Parameter NDF.
Here is another example, which could be used to flat field a series of CCD frames. Instead of
executing a specific number of files, you can enter an arbitrary sequence of NDFs. When
processing is completed a !! is entered rather than an NDF name, and that exits the loop. Note
the ˜
continuation character (it’s not required but it’s included for pedagogical reasons).
Some Kappa applications, particularly the statistical ones, produce output parameters, which can be passed between applications via ICL variables. Here is an example to draw a contour plot centred about a star in a nominated data array from only the star’s approximate position. The region about the star is stored in an output NDF file. Note the syntax required to define the value of Parameter INIT; the space between the left bracket and parenthesis is essential.