That worked! Thank you for catching the error in my code. Regards, Rachita
> On Jan 13, 2021, at 12:51 PM, Matt Newville <newvi...@cars.uchicago.edu> > wrote: > > Hi Rachita, > > On Wed, Jan 13, 2021 at 2:00 PM Rachita Rana <racr...@ucdavis.edu > <mailto:racr...@ucdavis.edu>> wrote: > Hi Everyone, > > I am using Larch for reading and fitting EXAFS data and I get the autobk and > Fourier transforms working. But when I try to generate the fefffpaths and fit > the data I get an error from the feffit function. I am using the developer > version of Larch on MC OS Catalina. Below is the error and the sample script- > > runfile('/Users/rachita/Box/Larch/Feff_Try2/001.py', > wdir='/Users/rachita/Box/Larch/Feff_Try2') > Traceback (most recent call last): > > File "/Users/rachita/Box/Larch/Feff_Try2/001.py", line 27, in <module> > fit = feffit(params, dset) > > File > "/Users/rachita/opt/anaconda3/lib/python3.8/site-packages/xraylarch-0.9.50-py3.8.egg/larch/xafs/feffit.py", > line 534, in feffit > ds.prepare_fit(params=params) > > File > "/Users/rachita/opt/anaconda3/lib/python3.8/site-packages/xraylarch-0.9.50-py3.8.egg/larch/xafs/feffit.py", > line 265, in prepare_fit > ikmax = int(1.01 + max(self.data.k)/trans.kstep) > > AttributeError: 'AthenaGroup' object has no attribute ‘k’ #tried this with > xdi format data and got the same error > > > I think this is because your script actually did not do the background > subtraction. The "read_xdi()" command reads in the raw data, which probably > contains "energy" and "mu" arrays, but not "k" and "chi" arrays. You said > you got autobk and ffts working, you probably want to just add a > > autobk(data, rbkg=1.0) > > command (maybe with other options). That will add "k" and "chi" arrays to > the "data" group, which feffit() is expecting. > > I guess the error message could be clearer there.... > > > > > > Below is the script - > > #!/usr/bin/env python3 > # -*- coding: utf-8 -*- > from larch.fitting import param_group, Parameter > from larch.io <http://larch.io/> import read_xdi > from larch.xafs import feffpath, feffit_dataset, feffit_transform, feffit, > feffit_report > > data = read_xdi('cu_metal_rt.xdi’) #I tried importing Athena project file > too > > path1 = feffpath('feff0001.dat', s02='amplitude', e0='del_e0', > sigma2='sigma2', deltar='del_r') > > trans = feffit_transform(kmin=3, kmax=16, kw=(2,1,3), > dk=1, window='hanning', rmin=1.7, rmax=3.1) > > params = param_group(amplitude= Parameter(1, vary=True), > del_e0 = Parameter(1e-7, vary=True), > del_r = Parameter(1e-7, vary=True), > sigma2 = Parameter(0.003, vary=True)) > > dset = feffit_dataset(data=data, pathlist=[path1], transform=trans) > fit = feffit(params, dset) > > print(feffit_report(fit)) > > By printing path groups and transform fit, I confirmed that the data is read > correctly. > > Please let me know if there are ways to fix this or if there is an error in > my script. > > Thank You! > > Rachita > _______________________________________________ > Ifeffit mailing list > Ifeffit@millenia.cars.aps.anl.gov <mailto:Ifeffit@millenia.cars.aps.anl.gov> > http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit > <http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit> > Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit > <http://millenia.cars.aps.anl.gov/mailman/options/ifeffit> > > > > --Matt > _______________________________________________ > Ifeffit mailing list > Ifeffit@millenia.cars.aps.anl.gov <mailto:Ifeffit@millenia.cars.aps.anl.gov> > http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit > <http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit> > Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit > <http://millenia.cars.aps.anl.gov/mailman/options/ifeffit>
_______________________________________________ Ifeffit mailing list Ifeffit@millenia.cars.aps.anl.gov http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit