This section is about getting information back from IFEFFIT, either at the command-line, or written to external files.
At some point, you'll want to write out some of IFEFFIT's arrays to a file. This is done fairly simply with the write_data() command, which will write a plain ASCII file containing text strings and scalar values at the top of the file as ``comment lines'', then arrays in column format. The syntax for write_data() is fairly simple, consisting of a file name, and a list of arrays, scalars, and strings to write out, as in
Ifeffit> $title1 = 'Fit #1, varying 4 variables'
Ifeffit> write_data(file='x_fit.chi', rmin, rmax,
fit.k, fit.chi, $title1)
which will write the file x_fit.chi, which will have header lines
from $title1, rmin, rmax looking like this:
# Fit #1, varying 4 variables # rmin = 1.5000000 # rmax = 3.5000000 #------------------------ # k chi 0.0000000 0.40189216E-01 |
The string program variables are always written first, in the order they appear in the argument list, followed by the scalars (as shown) in the order they appear in the argument. Finally, the arrays will be written in the order they appear, with the first one being in the first column.
While doing a complex analysis, it's often necessary to save values and information into a file for later inspection. While not extremely sophisticated, one simple way to do this is to have everything that would be written to the screen written to a log file. This is surprisingly effective way of keeping track of your analysis session, and may well inspire you to insert many more show() and print() commands in your scripts.
To open a log file, you use the log() command, naming the log file to use, and specify the ``screen echo'' mode:
Ifeffit> log(my_test.log, screen_echo = 3)where the ``screen_echo = 3'' selects writing to both the screen and to the log file. Other values for this parameter are discussed in the Reference Guide.
To close a log file, you say
Ifeffit> log(close)Only one log file can be open at a time - opening a log file when one is already open will cause the first to be closed. If the program exits with a log file opened, it is not guaranteed that all information will be actually written to the log file. (NB: This is under investigation, and is hoped to be fixed in a future version).
It's often desirable to suspend an analysis session and save the current point in the session, either to return to it later or to compare your results with someone else's. To this end, IFEFFIT allows you to save the current state of all program variables into a single file that can be read in later. The saved file is portable across different platforms.
The save command will save the current state. It takes a few optional arguments, the most important of which is the file name, which defaults to ifeffit.sav. That is
Ifeffit>savewill write ifeffit.sav, and
Ifeffit>save( current.sav)will save the program state to current.sav. You can also specify what kinds of program variables to save with optional arguments like with_strings, no_strings, with_arrays, no_arrays, and so forth. The default is to save everything.
To restore a previously saved session, you use the restore command, giving it the name of the save file (again, ifeffit.sav by default):
Ifeffit>restore( my_save_file.sav)This will load all the program variables saved in the given file. Note that it will not erase any program variables that may have existed in the current session, but will overwrite any variables with the same name. This means that unless you start with a new session, it's possible that restoring a session may not produce an identical session to the previous one.