## examples/xafs/doc_autobk4.lar

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)

plot_chik(cu1, kweight=2, label='no std')
plot_chik(cu2, kweight=2, label='with std', new=False)
## end of examples/xafs/doc_autobk4.lar
