Hi Gerome,

(I'm CCing this to the Ifeffit mailing list)


On Thu, Feb 25, 2016 at 9:30 PM, Gerome Melaet <gmelaet@lbl.gov> wrote:
Dear Dr. Newville, 
I have tried to use the flu_corr() function to correct some of my recent x-ray data on the cobalt K-edge. 
Unfortunately, after multiple tryout I am unable to get it to work properly. 
I have received this error message a couple of time.


File "/Volumes/Python/anaconda/lib/python2.7/site-packages/larch/__init__.py", line 37, in wrapper
    return fcn(*args, **keywords)
  File "/Volumes/Python/anaconda/share/larch/plugins/xafs/fluo.py", line 57, in fluo_corr
    muvals   = material_mu(formula, energies, density=1, _larch=_larch)
  File "/Volumes/Python/anaconda/lib/python2.7/site-packages/larch/__init__.py", line 37, in wrapper
    return fcn(*args, **keywords)
  File "/Volumes/Python/anaconda/share/larch/plugins/xray/materials.py", line 68, in material_mu
    mater = _materials.get(name.lower(), None)file <stdin>, line 0
AttributeError: ‘int' object has no attribute 'lower'

I have a .dat file two column with energy and normalized mu (I have done most of the energy corrections during my shift at the synchrotron). 
I am able to load both energy and mu, yet I am not sure I handle the different args correctly in the fluo_corr() function. 

Here is how I tried: 

fluo_corr(dat.energy, dat.mu, formula=None, elem=‘Co’, edge=‘K’)

Thanks in advance for your help, 

Best, 
Gerome 


Yes, you need to pass a valid (even if approximate) formula for the chemical composition of the material.   See http://xraypy.github.io/xraylarch/xray/index.html#x-ray-properties-of-materials-and-chemicals for some further details.  

You might want to do something like

      fluo_corr(dat.energy, dat.mu, formula='Co0.5Fe0.5S04', elem=‘Co’, edge=‘K’)

Perhaps obviously, getting the composition of light elements perfect is not critical.  It's often noticed that one has to lower the concentration of the absorbing element some (perhaps even by half) to avoid over-correcting.    As with many things, it's always good to practice on a system where you're pretty confident what the right answer should be.

--Matt