[Ifeffit] Larch: AttributeError

Rachita Rana racrana at ucdavis.edu
Wed Jan 13 13:59:48 CST 2021

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

  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

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)


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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://millenia.cars.aps.anl.gov/pipermail/ifeffit/attachments/20210113/b536731f/attachment.htm>

More information about the Ifeffit mailing list