SPEX Reference manual (PDF) - SRON
SPEX Reference manual (PDF) - SRON
SPEX Reference manual (PDF) - SRON
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
2.16 Log: Making and using command files 29<br />
In orderto facilitate the readabilityofthe command files, the user can put comment lines in the command<br />
files. Comment lines are recognized by the first character, that must be #. Also blank lines are allowed<br />
in the command file, in order to enhance (human) readability.<br />
Saving commands to file<br />
After the command log save #a is given on the <strong>SPEX</strong> command line (#a is the file name), all the<br />
following commands entered by the user (NOT the ones before) are stored on the command file until the<br />
log close out command is given. Exceptions are the commands read from a nested command file (it<br />
is not necessary to save these commands, since they are already in the nested command file). Also, help<br />
calls and the command to open the file (”log save #a”) are not stored.<br />
All commands are expanded to the full keywords before they are saved in the file. However, for execution<br />
this is not important, since the interpreter can read both abbrevated and full keywords.<br />
Saving the commands to the command file can be stopped by giving the command log close save.<br />
The file with the saved commands is closed and remains at the specified path. <strong>SPEX</strong> will automatically<br />
append the extension ”.com” to the filename.<br />
Saving output to file<br />
It is also possible to store all the output that is printed on the screen to a file. This is usefull for<br />
long sessions or for computer systems with a limited screen buffer. The output saved this way could be<br />
inspected later by (other programs of) the user. It is also useful if <strong>SPEX</strong> is run in a kind of batch-mode.<br />
The command to save the output is log out #a, where #a should be the filename without extension.<br />
<strong>SPEX</strong> will automatically append the extension ”.out” to the filename.<br />
Executing commands from file<br />
ASCII files with the .com extension containing <strong>SPEX</strong> commands can be executed in <strong>SPEX</strong> using the<br />
command log execute #a, where #a stands for the file name without the ”.com” extension. When a<br />
command file is read and the end of file is reached, the text ”Normal end of command file encountered”<br />
is printed on the screen, and execution of the calling command file is resumed, or if the command file<br />
was opened from the terminal, control is passed over to the terminal again.<br />
For example, the user may have a command file named run which does his entire analysis. This command<br />
file might start with the line ”log exe mydata” that will run the command file mydata that contains all<br />
information regarding to the data sets read, further data selection or binning etc. This could be followed<br />
by a second line in run like ”log exe mymodel” that runs the command file mymodel which could contain<br />
the set-up for the spectral model and/or parameters. Also, often used plot settings (e.g. stacking of<br />
different plot types) could easily placed in separate command files.<br />
Syntax<br />
The following syntax rules apply for command files:<br />
log exe #a - Execute the commands from the file #a. The suffix ”.com” will be automatically appended<br />
to this filename.<br />
log save #a [overwrite] [append]- Storeall subsequent commandson the file #a. The suffix ”.com”<br />
will be automatically appended to this filename. The optional argument ”overwrite” will allow to overwrite<br />
an already existing file with the same name. The argument ”append” indicates that if the file<br />
already exists, the new commands will be appended at the end of this file.<br />
log close save - Close the current command file where commands are stored. No further commands<br />
will be written to this file.<br />
log out #a [overwrite] [append] - Store all subsequent screen output on the file #a. The suffix<br />
”.out” will be automatically appended to this filename. The optional argument ”overwrite” will allow to<br />
overwrite an already existing file with the same name. The argument ”append” indicates that if the file<br />
already exists, the new output will be appended at the end of this file.<br />
log close output - Close the current ascii file where screen output is stored. No further output will be