Background Subtraction (Autobk / Spline / Athena / SixPACK) ?

How does pre_edge() normalize XAFS data?

The pre_edge() command (and Athena, which uses this command) fits a line to the pre-edge region (over a region defined by the parameters pre1 and pre2, relative to E0), and a quadratic function to the post-edge region of the data (over a region defined by the parameters norm1 and norm2, relative to E0). Both of these curves are then extended to E0, and the difference of these two curves at E0 gives the edge step.

When the spline() command is run, it updates the value of edge step by using the background function (not the original mu(E) data) for the post-edge fit. Though this does not usually change the edge step by much, it is somewhat more stable.


How can I use tabulated values of mu(E) to normalize XAFS data?

The bkg_cl() command uses the data in the Cromer-Libermann tables to do pre-edge subtraction, normalization. and simple background-subtraction of XAFS data.

 read_data(file = ../data/cu.xmu, prefix = dat, type = xmu)
 bkg_cl(, xmu = dat.xmu, z=29)
 newplot (, dat.norm)
 plot (, dat.f2norm)

The array dat.f2norm will be the scaled set of values for the background function.


What are reasonable values for kmin, kmax, kweight, and rbkg in spline()?

For spline() and for Autobk, Matt's recommendations are:




0 (which will use the full data range)






1. (or half near-neighbor distance)

All of these numbers can be set as preferences in Athena. The Preferences dialog is under the Settings menu. Look in the bkg branch of the preferences tree.


When is E0 changed by spline()?

E0 is changed by spline() if one of the following conditions is met:

  1. E0 (that is, the variable e0) is not already set.
  2. E0 (that is, the variable e0) is out of range of the data sent to spline().
  3. The keyword finde0 is given to spline()

  4. A standard chi(k) is given to spline(), and finde0=false is not set, and e0 is not explicitly set.

Basically, this translates to:

Note that Athena never floats E0 and currently does not provide an option to do so.


The background function 'swoops up' at the end points. What can be done about this?

You can use clamps for the background removal. These add extra 'weight' to the difference between mu(E) and mu_0(E) at the endpoints (either low-k or high-k or both). For example,

spline(energy=, xmu= my.xmu, rbkg=1.0,clamp2=1.0) 

will add some extra weight to the fit from the high-k endpoint.

spline(energy=, xmu= my.xmu, rbkg=1.0, clamp2=10.0)

will add more weight. You can effectively force chi(k) = 0 at k=kmax by setting clamp2 to 1000. Similarly,

spline(energy=, xmu= my.xmu, rbkg=1.0, clamp1=1.0)

will 'encourage' chi(k) toward 0 at k=kmin.

In Athena the control over the clamp values is somewhat less fine grained. Each clamp has six possibilities:

Athena Setting

value of clamp













The values can be configured in Athena. In preferences dialog (see the Settings menu), go to the Clamp branch to adjust the numerical values associated with slight ... rigid.


How do Ifeffit and Athena determine E0?

See Bruce's Post.

Various menus in Athena provide a number of options ofr setting E0. The default is to use the value that Ifeffits pre_edge() function finds. That is a value close to the first big peak in the first derivative. The other available options are to set it to the point at a fraction of the edge step (the fraction is configurable in the preferences dialog), to set it to the zero crossing of the second derivative (this starts from Ifeffit's default then finds the zero crossing nearest to that point), or to set it to the tabulated atomic value. The fraction option is a popular tool for measuring energy shifts in XANES spectra. The zero-crossing option easy to explain and reproduce, but may be flaky for noisy data.


How do I calibrate the energy of my data?

See Shelly's Post.


Shelly Kelly's background removal procedure

This procedure was suggested by Shelly (see also This Post).

I have found a procedure for removing the background that "almost" always works well. It goes something like this and uses different k-weightings in the background removal process.

  1. Check out the curvature of the XANES region and how quickly the data goes from zero to 1, call this DExanes. There are in my small opinion two categories for each of these different parameters. Curvature of Xanes can be step like or it can have a large peak. DExanes can be small ~10eV for k-edges of Cu or wide ~30eV for L3-edge of U.
  2. Choosing Ezero for the first time: If you have a wide DExanes, then choose Ezero up near the top of the edge. If you have a small DExanes, then choose Ezero around the middle of the edge. Set kweight equal to one or zero (and no theory) and remove the background. This will emphasize the low k-region around the edge, but often get the background for the higher k-region not as well...especially for noisy data.
  3. Check out the shape of the background function, the chi(k) data and the FT. Make sure that rbkg=1.0 is a reasonable thing to do. Make sure that you look at the chik data with all three k-weights. Often people say that there is no change in the chik data by changing the kwieght but they are looking at the chik*k3. The change will be greatest at low k, which you don't really see with chik*k3.
  4. If you have a large peak in the XANES region, Athena may need help getting the bkg to go through that peak. You have two options:
    1. increase rbkg so that the spline has more freedom to curve in this region.
    2. increase kmin of the spline range, essentially removing the large peak from the data
  5. Fit the first shell of your data, use a well padded chik data range...don't include at least one full oscillation at the beginning. i.e. use kmin=3 or greater. Monitor the value for ezero. If it is greater than 10eV you need to start over. (I have some more details on how to create a theory to be used for bkg removal on my web site my web site from the 2004 NSLS EXAFS workshop presentation)

  6. Read the theory back into Athena. Now Athena knows what the low k-range should look like, and you can increase the k-weight of the background, use kw=2 or 3, to get the high k-range part of the data correct as well.
  7. Fit the data again and use as much of the k-range as possible.


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]


FAQ/BkgSpline (last edited 2009-10-09 19:46:44 by localhost)