View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

SPP parameter flushing?

Rob Seaman wrote on Nov 16, 1998

Bob Abraham writes:

> I have a question with regard to SPP programming: do SPP tasks always set
> their parameter variables on exit after being called from CL scripts, or
> does one sometimes need to flush a buffer or something in order to update
> the variables correctly?

No such flushing should be needed.  Note, however, that only a very few
tasks rely on writing to their parameter files.  The biggest complication
with this mechanism is that IRAF tasks that are run in the background
are not permitted to actually update their parameter files on output.
The point of this is to avoid collisions with other instances of the
same task running in either the foreground or in other background jobs
and reading and writing the same parameters.

> I find that if I run this interactively from the command line, it works
> fine, but if call my SPP program from a CL script and try to access the
> task's parameter variables within the script (eg. with statements like
> total = sum.maskpix after calling sum to analyse the image) then the
> variables are not correctly set. But if I wait until the CL script is
> finished and then examine the hidden parameter variables (ie. by typing:
> =sum.maskpix at the command line), lo and behold the numbers are correct.

You don't explicitly mention whether the script is being executed in the
foreground or the background.  (The fact that the parameters appear to be
updated when the script is finished suggests that you are running in the
foreground.)

It isn't clear what is happening from the information provided.  I would
first suggest that you take a look at the "cache" and "update" commands.
Most IRAF users seem to be aware of the "unlearn" command, but may not
have encountered "cache", which arranges for a copy of a task's parameters 
to be buffered in a memory cache, or "update" which forces a cached
parameter set to be written to the corresponding disk copy of the
parameter file in the user's uparm directory.

The fix for the problem of using a task that writes output values into
its parameters - within a background script - is to include the line
"cache (taskname>" near the top of the script.

On the other hand, if there is some unknown problem with your SPP task
updating its parameter file, perhaps an explicit "update <taskname>"
immediately after running the task may help.

Please contact the IRAF group at iraf@noao.edu if you continue to have
problems and we can arrange a closer look at your program and script.

Rob Seaman
NOAO/IRAF

Last post on Nov 16, 1998