DEMETER offers a large number of output formats for the various kinds of data handled by the various kinds of objects.
There are a number of ways to save Data, Path, and path-like objects into column data files that can be plotted using other plotting programs or imported into a spreadsheet program.
The available single object output types are:
The header of the fit and bkgsub file types is generated using the data_parameter_report method which, in turn, takes its formatting from the data_report.tmpl template file.
This line of code:
generates this text:
. Element=Au Edge=l3 Background parameters . E0=11919.166 Eshift=0 Rbkg=1.6 . Standard=None . k-weight=1 Edge step=0.8548872 . Fixed step=no Flatten=yes . Pre-edge range: [ -150 : -30 ] . Pre-edge line: 2.404416 - 0.000174619 * energy . Normalization range: [ 150 : 869.877293080001 ] . Post-edge polynomial: 4.337632 - 0.000197019 * en - 5.71097e-09 * en^2 . Spline range (energy): [ 0.000 : 969.877 ] Clamps: 0/24 . Spline range (k): [ 0.000 : 15.955 ] Foreward FT parameters . Kweight=1 Window=kaiser-bessel Phase correction=0 . k-range: [ 2 : 13 ] dk=1 Backward FT parameters . R-range: [ 1 : 3 ] . dR=0.2 Window=kaiser-bessel Plotting parameters . Multiplier=1 Y-offset=0.0000
The results of a fit can be saved in one of two special column data files:
The save method takes an additional argument used only for the fit type. It specifies what form of the data and the other parts to write to the file. It can take a value of k, k1, k2, k3, rmag, rre, rim, qmag, qre, or qim to indicate the space, the k-weighting for k-space output, or the part of the complex function for R- or q-space output. The default (no argument) is k, i.e. un-k-weighted χ(k).
The header of the fit and bkgsub file types is generated using the fit_parameter_report method which, in turn, takes its formatting from the fit_report.tmpl template file.
This line of code:
generates this text:
Demeter fit file -- Demeter 0.4.1 : file = cu10k.chi : name = My copper data : k-range = 3.000 - 14.000 : dk = 1 : k-window = hanning : k-weight = 1,2,3 : R-range = 1.6 - 4.3 : dR = 0.0 : R-window = hanning : fitting space = r : background function = no : phase correction = 0
DEMETER offers the save_many method as a way to export many Data, Path, and pathlike objects to a single column data file which can be easily imported into a plotting or spreadsheet program. The x-axis of the export space will be in the first column, followed by one column for each object exported. Those columns will be in the order specified in the method call.
The first argument is the output file name. The second argument is the kind of data to write out (see the list below). The remaining arguments are Data, Path, or pathlike objects to wrtie to the file. The calling object (which san be any Data, Path, or pathlike object) will be added to the front of the list of objects to export. Care is taken not to export the caller twice if it also appears in the argument list and the caller appears in the second column of the output file.
Every item in the list is interpolated (if necessary) to the grid of the caller.
The available types are as follows (note that trying to write energy data with Path or pathlike objects in the argument list will trigger an error):
xmu: save μ(E) for all objects in the argument list.
norm: save normalized μ(E) for all objects in the argument list.
der: save the derivative of μ(E) for all objects in the argument list.
nder: save the derivative of normalized μ(E) for all objects in the argument list.
sec: save the second derivative of μ(E) for all objects in the argument list.
nsec: save the second derivative of normalized μ(E) for all objects in the argument list.
chi: save unweighted χ(k) for all objects in the argument list.
chik: save k¹-weighted χ(k) for all objects in the argument list.
chik2: save k²-weighted χ(k) for all objects in the argument list.
chik3: save k³-weighted χ(k) for all objects in the argument list.
chir_mag: save the magnitude of χ(R) for all objects in the argument list.
chir_re: save the real part of χ(R) for all objects in the argument list.
chir_im: save the imaginary part of χ(R) for all objects in the argument list.
chiq_mag: save the magnitude of χ(q) for all objects in the argument list.
chiq_re: save the real part of χ(q) for all objects in the argument list.
chiq_im: save the imaginary part of χ(q) for all objects in the argument list.
You can export an ATHENA project files from a group of data objects like so:
The first argument is the filename for the project file. This is followed by a list additional data objects to export. The caller will be the first group in the project file, followed by the addition data in the order supplied. If the caller is also in the list, it will not be written twice to the project file.
This is, in every way, a normal ATHENA project file that can be imported by ATHENA or ARTEMIS (either the old version or the new version).
Every DEMETER object type has a serialization format. The purpose of this is to freeze the state of an object to disk in a form that can be easily reimported to recover the state of the object.
These files use the YAML data serialization format. YAML is a fairly simple, text-only way of recording state of an object. Although you should never need to do so, you can examine or even edit a YAML file with any text editor. To save a little space, DEMETER compresses the files using the same algorithm as the gzip program. This kind of compressed file can be read by most compression or archiving programs on all platforms.
An object is written to a yaml file using the freeze method. It's argument is the name of the output file.
You can import one of these serialization using the thaw method. It's argument is the name of the file to import. It returns the object.
The Fit object has a logfile method.
Project files are zip files filled with YAML files and other things.
ATOMS and FEFF I/O
DEMETER and IFEFFIT scripts