We start with a fairly complete example (see the tutorial for a more gentle
introduction). We'll assume that we have some raw data from a beamline in a
plain-text column format, and want to convert it to
(E), do a
background subtraction, Fourier Transform, and then see what the data looks
like in R-space. Though a very practical request, it's a fair bit of
data processing. Here's what the session might look like:
Ifeffit> read_data(file=Cu.dat, type=raw, group= cu) Ifeffit> cu.energy = cu.1 * 1000.0 Ifeffit> cu.xmu = ln(cu.2 / cu.3) Ifeffit> spline(energy = cu.energy, xmu = cu.xmu, Ifeffit> rbkg=1.1, kweight=1., kmin=0) Ifeffit> plot(cu.energy, cu.xmu) Ifeffit> plot(cu.energy, cu.bkg, xmin=8850, xmax=9300, Ifeffit> color=red) Ifeffit> cu.chi_kw = cu.chi * cu.k^2 Ifeffit> newplot(cu.k, cu.chi_kw) Ifeffit> fftf(real = cu.chi, kmin = 2.0, kmax = 13.0, Ifeffit> dk = 1.0, kweight=2) Ifeffit> newplot(cu.r, cu.chir_mag, xmax=8) Ifeffit> $title1 = "Test: writing out k, chi, chi*k" Ifeffit> $title2 = " data from Cu.dat, rbkg = 1.0" Ifeffit> write_data(file = Out.chi, cu.k, cu.chi, Ifeffit> cu.chi_kw, $title1, $title2)
One important aspect of IFEFFIT is that you can save commands into a file and execute all commands in that file at one time. By saving the above commands into the file process.iff, we could simply type load process.iff at the IFEFFIT command line. These two methods of running these commands are completely equivalent.
We'll now go through each of these lines in detail. If there is too much detail here, please go through the The IFEFFIT Tutorial.
Ifeffit> read_data(file=Cu.dat, type=raw, group= cu)This command reads in data arrays from the ASCII column file Cu.dat. The arguments type=raw and group=cu help read_data()() name the arrays it reads in. Because arrays are often read in and processed together, it is convenient to give them names that are related. Arrays names always have two parts - a prefix and suffix, with a dot '.' in between. The prefix gives the group name, and the suffix explains what the data contains. Here, cu is used as the group name (prefix). The type raw is the simplest type, so the suffixes will just be the column index. To make a long story short, we just read in the arrays cu.1, cu.2, and cu.3.
Ifeffit> cu.energy = cu.1 * 1000. Ifeffit> cu.xmu = ln(cu.2 / cu.3)Presumably, we know what the contents of our data file. For this Cu.dat file, the column contained energy in keV, the second contained I0 and the third I, for absorption data measured in transmission. There might have been more columns in the file, but this is all we need at this point. IFEFFIT prefers to think about energy in eV not keV, so we make an array cu.energy that has energy in eV, and then we calculate
Ifeffit> spline(energy = cu.energy, xmu = cu.xmu, Ifeffit> rbkg=1.1,kweight=1.,kmin=0)This computes the background spline
Like many other commands, spline() uses, modifies, and (if necessary)
creates several arrays and scalars. The complete list of what
spline() uses is listed in section 9.42. For now a
partial list will do: spline() sets the arrays cu.bkg to
contain
(E), cu.k to contain the k values, and
cu.chi to contain
(k). Several scalar values (including
rbkg, kweight, kmin, and e0) are also set by
spline(). You can see the values of these variables with the
show() command - try show(e0, kmax) for example.
Ifeffit> plot(cu.energy, cu.xmu)This plots
Ifeffit> plot(cu.energy, cu.bkg, xmin= 8850, xmax= 9300, Ifeffit> color=red)This adds a plot of
Ifeffit> cu.chi_kw = cu.chi * cu.k^kweightThis creates the array cu.chi_kw which contains k2
Ifeffit> newplot(cu.k, cu.chi_kw)This plots the k-weighted
Ifeffit> fftf(real = cu.chi, kmin = 2.0, kmax = 13.0, Ifeffit> dk = 1.0, kweight=2)This does the forward XAFS Fourier transform of
Ifeffit> newplot(cu.r, cu.chir_mag, xmax = 8)Now we plot |
Ifeffit> $title1 = "Test: writing out k, chi, chi*k" Ifeffit> $title2 = " data from Cu.dat, rbkg = 1.1"Here we define a pair of text string variables, which always have names starting with a dollar sign. These are useful for doing things like
Ifeffit> write_data(file = out.chi, cu.k, cu.chi, Ifeffit> cu.chi_kw, $title1, $title2,e0,rbkg)in which we save the