
fname = '../xafsdata/cu.xmu'
chi_fname = '../xafsdata/cu10k.chi'

cu1 = read_ascii(fname)

chidat = read_ascii(chi_fname, labels='k chi')

pre_edge(cu1.energy, cu1.mu, group=cu1)

cu2 = copy(cu1)

autobk(cu1.energy, cu1.mu, rbkg=1, group=cu1)

# now with std...
autobk(cu2.energy, cu2.mu, rbkg=1, group=cu2, k_std=chidat.k, chi_std=chidat.chi)

xftf(cu1.k, cu1.chi, kmin=2, kmax=16, dk=2, kweight=2, window='han', group=cu1)

xftf(cu2.k, cu2.chi, kmin=2, kmax=16, dk=2, kweight=2, window='han', group=cu2)


plot(cu1.k, cu1.chi*cu1.k**2, label='no std', new=True,
        ylabel =' $ k^2 \chi(k) $ ',
        xlabel=' $ k (\AA^{-1}) $ ',   title='  $ \chi(k)$ ' )

plot(cu2.k, cu2.chi*cu2.k**2, label='with std')
