Data Handling In Ifeffit
Contents
What kind of data does IFEFFIT read?
IFEFFIT reads ASCII column data. Currently there is no specific support for any beamline's data format, but most ASCII files can be read.
Athena uses Ifeffit's read_data() function, so what's true for Ifeffit is true for Athena as well, but with a few exceptions.
For example, Athena preprocesses data from NSLS beamline X10c specially so that it will be read correctly by Ifeffit. Also Athena tries to recognize data from a CCD camera by noticing when the energy axis consists entirely of integers increasing by 1.
Several users from countries whose languages require unicode (Japan and China for instance) have reported problems importing data files when the data file lies in a folder whose name cannot be represented in ascii. As explained here, the work-around is to move your data into a folder with an entirely ascii name.
Is the RDF / UWXAFS binary format supported?
No.
IFEFFIT has its own program-specific file format (PAD) that can save multiple spectra to a single file. The PAD format has a few key advantages over RDF:
- it is not restricted to the number of spectra it can hold
- it can hold more than one type of spectra. That is, mu(E), chi(k), and chi(R) can all be saved in a single file.
- it is not a machine-dependent binary files. In fact, it contains only printable ASCII characters, and so fully portable across systems -- it can be sent by email.
How can I read data file from Farrel Lytle database?
The Lytle database at IIT: (ftp://ixs.iit.edu/data/Farrel_Lytle_data/) contains a lot of XAFS data -- some of it is good, some of it is not so good.
The database actually contains files in a few different formats. Most of these files do not record the x-ray energy in eV (the units Ifeffit expects), but instead records the motor position for the monochromator angle. To convert this value to x-ray energy in eV, you need to know
- steps-per-unit-angle for the monochomator angle (typically, 8000 steps per degree)
- the lattice constant (or Miller index) of the monochromator.
Unfortunately, this information isn't held in the files in any standard way. That means you have to read the file and often try (trial-and-error) several combinations until the energy scale makes sense.
In addition, many of the files have many "data channels" for data measured in transmission, fluorescence, and electron yield. You may have to do some guesswork to figure out which channels you want to use as well.
One of the more common formats that contains monochromator position in motor steps, with headers like:
NPTS NS CUEDGE CUHITE DSPACE STPDEG STEPMM START STOP SCALE
468 3 84294. 200000. 1.92017 4000. 3150. 85290. 75506. 2.000
DELTA: 50. 5. 22. 36. 48.
DELEND: 84788. 83804. 81216. 76752. 71076.
SEC: 2.000 2.000 2.000 2.000 2.000
OFFSET: 1140. 1608. 401. 4. 4. 6. 137. 4. 6. 18. 641. 3. 2. 5. 61. 20. 93. 232. 0. 0. 0. 0. 0. 0.
SINGLE XTAL CUINSE2 CHALCOPYRITE 7 7 5-30-83
85290. 2.62740E+05 2.69329E+05 1.37453E+04
The first step is to edit the file to have # comment characters at the beginning of each line before the 'real data' starts. Notice that this file has STPDEG = 4000 and DSPACE = 1.92017. That's the steps-per-degree and the d-spacing of the monochromator. Also notice that CUEDGE = 84294, suggesting that the Cu K edge (~8980.0 eV) happens at a motor step of 84294.
Then the job becomes converting motor step to monochromator angle and then to energy. It usually goes something like this:
# macro lytle file group 4000 read_data ($1, group=$2, label='steps i0 i1 i2') set (dspace = 1.92017, stpdeg = $3) set (r2d = 57.29577951, hc = 12398.61) set $2.energy = hc / (2 * dspace) / sin($2.steps / (r2d * stpdeg)) set $2.xmut = -log($2.i1/$2.i0) set $2.xmuf = ($2.i2/$2.i0) pre_edge $2.energy, $2.xmut end macro
Where the 4000 there is the steps-per-degree to use. Again, you can often figure this out from the data file.
Another common file format looks like this:
CUEDGE START STOP BEG FSCTS: 168620. 176600. 133300. 272000. 5.
DELTA: 1000. 9. 60. 8. 50.
DELEND: 169600. 167700. 157100. 155400. 133300.
SEC: 1. 2. 2. 1. 1.
CU IN ZNO 2.34 WT %DATA AT LIQ NT
176600.0 1.913555 175600.0 1.811836 174600.0 1.712986 173600.0 1.617992
172600.0 1.524191 171600.0 1.440715 170600.0 1.364779 169600.0 1.293182
Notice that this file is really 2 arrays spread across 8 columns!!
To read such files, you can try this macro:
macro read_lytle file group 4000 read_data ($1, group=$2, narrays=2) set (dspace = 1.92017, stpdeg = $3) set (r2d = 57.29577951, hc = 12398.61) set $2.energy = hc / (2 * dspace) / sin($2.1 / (r2d * stpdeg)) set $2.xmu = $2.2 end macro
Here the line read_data ($1, group=$2, narrays=2) tells Ifeffit to really read the 8 columns as 2 arrays.
The above data file also used a steps-per-degree = 8000. That's essentially impossible to tell that from the data file itself except that CUEDGE is at 168620, which is about twice what it was for the above data file with a monochromator that had 4000 steps per degree.
Sheesh.
How can I convolve data with a lorenztian or gaussian?
Data can be convolved with a Lorenztian or Gaussian function using the math functions lconvolve() and gconvolve(). Both of these functions take 3 arguments: an x-array, and y-array, and a width parameter, (sigma).
Here's an example, reading data, convolving, and plotting the results:
# convolve data with a lorenztian, and gaussion function, # and plot the results</font> read_data(file = xmu_c0.dat ,group=c, label='e ex k mu mu0 chi') newplot ( c.e, c.mu, xmax=1870, key='data') # [g,l]convolve(en, y, sigma_en) set (c.lc = lconvolve(c.e, c.mu, 1.0)) set (c.gc = gconvolve(c.e, c.mu, 1.0)) # plot results</font> plot( c.e, c.lc, key='loren') plot( c.e, c.gc, key='gauss') plot( c.e, c.gc, xmax = 1860.)
How can I interpolate chi(k) data onto a finer/coarser k-grid?
How do I add a new FAQ entry?
Edit this section, use copy and paste! Use a format like this, using the same level of header (i.e. the same number of = signs) and keeping the link back to the contents at the top of the page:
== How do I add a new FAQ entry? ==
Edit this section, use copy and paste!
[#contents Contents]
----