next up previous 524
Next: Graphics Devices and Files
Up: Parameters
Previous: Examples


Output Parameters

Not only can programmes have parameters to which you supply values, but they can also write out the results of their calculations to output or results parameters. This makes the results accessible to subsequent tasks and to shell and ICL variables. Example results are statistics like the standard deviation or the FWHM of the point-spread function, the co-ordinates of points selected by a cursor, or the attributes of an NDF. They are not data files created by the application. In the application specifications they are listed separately from other parameters.

From the shell you can access these output parameters using the KAPPA tool PARGET. Suppose that you want to subtract the mean of an NDF called myndf to make an a new NDF called outndf.

    % stats myndf > /dev/null
    % set mean = `parget mean stats`
    % csub myndf $mean outndf 

STATS calculates the statistics of myndf, the displayed output being discarded. PARGET reports the mean value which is assigned to shell variable mean. Thereafter the mean value is accessible as $mean in that process. Thus the final command subtracts the mean from myndf.

You can obtain vector values too.

    % ndftrace myndf > /dev/null
    % set axlab = `parget alabel ndftrace`
    % display otherndf style="'label(1)=$axlab[1],label(2)=$axlab[2]"' axes 

This displays the image otherndf surrounded by axes, but the plot's axis labels originate from another dataset called myndf 3. There are more examples in the C-Shell Cookbook.

At the time of writing, ICL only permits scalar variables. To do the first example above from ICL, you would enter something like this.

    ICL> stats myndf mean=(vmean)
    ICL> csub myndf (vmean) outndf

vmean is an ICL variable. The parentheses have the same effect as the $ in the C-shell example, meaning ``the value of'' the variable. Note that you can't redirect the output to /dev/null.

If you use the PROMPT keyword for an application with output parameters, the programme will bizarrely prompt you for these. It is not asking for a value, but a location where to store the value. It is strongly recommended that you just accept the default (normally zero) so that the values are written to their parameter file, and hence permits PARGET to work.



next up previous 524
Next: Graphics Devices and Files
Up: Parameters
Previous: Examples

KAPPA --- Kernel Application Package
Starlink User Note 95
Malcolm J. Currie & David S. Berry
2008 June 14
E-mail:ussc@star.rl.ac.uk

Copyright © 2008 Science and Technology Facilities Council