2.2 Invoking XAS commands

Each XAS program can be invoked in a variety of ways (the simplest of which is the interactive one) all of which may be useful in certain situations. We give below some examples of an hypothetical command performing the rotation of an image of a given angle around a given centre (this command does not exist !), using the standard notation conventions

Interactive invocation

All programs may be invoked interactively just by typing the command name, e.g.
rotate
after which you will be prompted at the terminal, e.g. as follows :
rotate
Input image name : pinco
Rotate around (X,Y df 128,128) : 100,120
Rotation angle : 75
Output image name : panco
Note that the answer to some questions is a single value (numeric or string), and the answer to some other is an array of values (numeric or string). In all cases it is NOT necessary to enclose strings in quotes.

Passing defaults

To accept the default value proposed by the program, just press return. In the case a question wants more than one value as answer, it is possible to type in only part of the values (and let the last ones default when pressing return), and also to default values at the beginning, using a comma separator for each skipped argument. E.g. to use (128,140) as answer to the question above one can answer as
Rotate around (X,Y df 128,128) : ,140

Signalling end of file

In reply to any question, one can also press the system-dependent end-of-file sequence (usually control-D on Unix, control-Z on VMS). Depending on the action coded in the program, this will terminate sooner or later, or continue assuming a default value.

Interrupting a program

If you press one of the system-dependent interrupt sequences (e.g. control-C or control-Y) while the program is waiting for input, this will be terminated ungracefully. However if you use the control-C (only) while the program is executing some long loop, most programs will trap this interrupt correctly and terminate in a graceful way (for accumulation programs this means all data files will be closed with a meaningful header : however the file content may be shorter, since it reflects the conditions at the moment of the break).

Passing all arguments on the run string

rotate pinco 100 120 75 panco
Input image name : pinco
Rotate around (X,Y df 128,128) : 100,120 
Rotation angle : 75
Output image name : panco

Compulsory arguments

Some programs require (always or under some conditions) that some (usually the first) arguments are always given on the run string. This is typically the case of arguments which specify an action which is dispatched to another program (e.g. accumulate image or accumulate spectrum will invoke separate programs for images and spectra). These cases will be identified in the examples as specified in the notation conventions. All remaining arguments, can be omitted as explained below.

Disabling echo

If you are not interested in the simulated dialogue with the echo of prompts and asnwers, you can disable it using
xasset echo OFF
If you later run interactively and forget to re-enable echo, you will get "anonymous" prompts of the form

WARNING : you are running with  ECHO OFF but ...
..I need input for (an) unspecified parameter(s)

Passing some arguments only

If only some arguments are passed on the run string, they will be accepted and echoed as above and you will be prompted for the missing arguments, as in the example :
rotate pinco 100 120
Input image name : pinco
Rotate around (X,Y df 128,128) : 100,120
Rotation angle : 75
Output image name : panco

Omitting or skipping arguments

Compulsory arguments described above cannot be omitted.
If the last arguments of the runstring are omitted (as in rotate pinco 100 120), they will be prompted interactively.
If one wants to skip some arguments (which will be prompted interactively) one can use null or blank fields separated by commas, as in the following two examples rotate ,, 100 120 75 panco or rotate pinco ,,, 75 panco.

Note that in the case of a question requiring more than one value, omitting the first value is equivalent to omitting the entire set of values, which will therefore be prompted. In the example you can do rotate pinco 100,, 75 panco to use a range of (100,128) changing the first value, but cannot do rotate pinco ,,140 75 panco.

An alternate form of omitting a parameter, is to put a placeholder (you need a single placeholder instead of both delimiting commas). In this case the above examples (with a dot placeholder) become:

rotate . 100 120 75 panco
rotate pinco . . 75 panco
rotate pinco 100 . 75 panco
rotate pinco . 140 75 panco
where the last example remains "illegal".
Note that both notations wilfully do not allow to take the program defaults unless accepting them explicitly with a carriage return. In order to take silently defaults one must use command files.

Using a command file

The complete syntax for command files is described elsewhere. If a command file is in use, the program will use it instead of interactive input from the terminal. The simulated dialogue of prompts and echoes of the answers read from the command file will be produced, unless echo is disabled.

A command file is established for use with

xasset command cfile
Compare the following example (the content of the particular command file can be viewed separately)
xasset command mycomfil
rotate 
Input image name : pinco
Rotate around (X,Y df 128,128) : 100,120 
Rotation angle : 75
Output image name : panco
A command file remains defined ONLY for the next XAS command invoked, and is reset afterwards, unless one explicitly asks to make it permanent. This is desirable if one wants to run several times in sequence the same program using the same setup.

A command file can be used as a parameter file containing a "standard" configuration, and one can also use an "all blank" command file to preserve all defaults.

Mixed cases

It is possible (and it is actually the most common usage) to combine the use of command files with runstring arguments. The latter take precedence over the command file, which is used as a sort of setup.
Compare the following examples. The
first command file contains the setup for a rotation of 75 degrees around (100,120) and can be applied to any file. The second command file contains instead a default "all blank" setup and is used to accept all program defaults.
xasset command mycomfil
rotate tizio . . . caio
Input image name : tizio
Rotate around (X,Y df 128,128) : 100,120 
Rotation angle : 75
Output image name : caio

xasset command alldefault
rotate pallino 
Input image name : pallino
Rotate around (X,Y df 128,128) : ,, 
Rotation angle : ,,
Output image name : panco
Note that if a command file contains "blank" defaults for an argument which does not accept defaults the results are not predictable.
For this reason, but not only, one may construct command files such that some arguments will always be prompted interactively at the terminal, unless explicitly present on the run string.
This is typically used for file names and other string arguments, like in the following example command file
xasset command newdefault
rotate pallino 
Input image name : pallino
Rotate around (X,Y df 128,128) : ,, 
Rotation angle : ,,
Output image name : usertypesnamehere

[Previous][Next] [Up][Down]

sax.iasf-milano.inaf.it/Xashelp/xasprog.2.html :: original creation 2002 Sep 04 17:40:20 CEST :: last edit 2002 Sep 04 17:40:20 CEST