Larch: Applications and Python Library for Data Analysis of X-ray Absorption Spectroscopy (XAS, XANES, XAFS, EXAFS), X-ray Fluorescence (XRF) Spectroscopy and Imaging, and more.
The group.kwin recorded in the mismatch with the group.k when the when the kstep in the autobk and xftf is different.
This will not affect the calculation of the R, since the R is calculated using the interpolated chi(k) and kwin, but it will affect on the plotting.
Sample code to reproduce the problem.
import matplotlib.pyplot as plt
from larch.xafs import pre_edge, autobk, xftf, ftwindow
group = Group()
group.energy = energy
group.mu = mu
pre_edge(group)
# The problem only occurs when we use non-default values for autobk or xftf
autobk(group, kstep=0.1)
# I am using hanning, kmin=2, dk=2 for clarity
xftf(group, window="hanning", kmin=1, dk=1)
correct_kwin = ftwindow(group.k, xmin=1, dx=1)
plt.plot(group.k, group.chi*group.k**2, label='chi(k)')
plt.plot(group.k, group.kwin, label='chi(k)*kwin')
plt.plot(group.k, correct_kwin, label='correct kwin')
plt.legend()
plt.xlim(0, 4)
plt.xlabel('k (A$^{-1}$)')
plt.ylabel('chi(k)')
plt.savefig('xftf.png', dpi=300)
The
group.kwin
recorded in the mismatch with thegroup.k
when the when the kstep in theautobk
andxftf
is different. This will not affect the calculation of theR
, since theR
is calculated using the interpolatedchi(k)
andkwin
, but it will affect on the plotting.Sample code to reproduce the problem.
Before correction:
After correction: