
cu = read_ascii('../xafsdata/cu_metal_rt.xdi')
autobk(cu.energy, cu.mutrans, group=cu, rbkg=1.0, kw=1)

fitparams = group(amp   = param(0.3, vary=True),
                  de0   = guess(0.1),
                  ss2   = param(0.002, vary=True),
                  alpha = guess(0.))

path1 = feffpath('feffcu01.dat',
                 s02    = '3*amp',
                 e0     = '2 + de0',
                 sigma2 = 'ss2',
                 deltar = 'reff*alpha')

trans = feffit_transform(kmin=3, kmax=17, kw=2, dk=3, rmin=1.4, rmax=3.0)
dset  = feffit_dataset(data=cu, pathlist=[path1], transform=trans)

out = feffit(fitparams, dset)

print( feffit_report(out))
plot(dset.data.k,  dset.data.chi *dset.data.k**2, new=True, label='data')
plot(dset.model.k, dset.model.chi*dset.model.k**2, label='fit')
