[Ifeffit] wavelet transforms for EXAFS
newville at cars.uchicago.edu
Tue Aug 14 16:27:52 CDT 2018
On Tue, Aug 14, 2018 at 7:07 AM Clark Adam Hugh (PSI) <adam.clark at psi.ch>
> Hi Matt
> I recently had some problems incorporating the larch Cauchy wavelet
> transform into my program for rapid bulk processing of QEXAFS data
> I particular after importing the relevant module into python the
> cauchy_wavelet(cwsam, kweight=kwwt, _larch=mylarch) function raises the
> error ‘not callable’. As a work around I have explicitly copied the module
> code for the definition into my own script and this seems to resolve the
A minimal example that shows the problem would be helpful, but I think I
can guess what is going on. Basically, the python API for lots of the XAFS
(and plotting) functionality in larch should be cleaned-up. My focus has
been on making the commands usable as larch commands, but the python API
has lots of inconsistencies. That said, this works for me:
from larch_plugins.io import read_ascii
from larch_plugins.xafs import autobk
from larch_plugins.xafs.cauchy_wavelet import cauchy_wavelet
import matplotlib.pyplot as plt
_larch = larch.Interpreter()
dat = read_ascii('feo_xafs.dat', _larch=_larch)
autobk(dat, rbkg=0.9, kweight=2, _larch=_larch)
cauchy_wavelet(dat, kweight=2, _larch=_larch)
That is, I would bet that the 'not callable' you are seeing is because of
the poorly exposed "cauchy_wavelet" call. Does that match what you are
> I also notice that at present that it is not possible to apply a windowing
> function within the wavelet transform, is this just a case of windowing the
> K space data that is fed to the module? I would also have interest in
> trying to fit the EXAFS data in the wavelet space, has there been any
> progress in Larch for performing this?
Yes, right now there is not a window function applied. We could add
that. From talking with you and a couple other people at the XAFS
conference, and other folks since then, it does seem that adding the Morlet
wavelet would be worth doing too. I'm not sure I have the code for this.
You can definitely fit EXAFS in wavelet space, just using
"feffit_transform(fitspace='w', ....)". There's an example of this at
> As briefly discussed at the EXAFS conference another feature that I think
> would be very nice to include would be the possibility to use a Victoreen
> function for the post edge normalisation instead of a polynomial function.
> I also briefly discussed the application of the MBACK algorithm. Unless I
> am doing something incorrect, when trying to use the MBACK algorithm in
> Larch within python the following error is raised ‘ ‘XrayDB’ object has no
> attribute _getChantler’. In some cases it would be very interesting to
> apply the MBACK algorithm particularly when only a short data range is
> collected in some experiments.
Yes, I remember that conversation well, and agree that getting some better
normalization using tabulated mu/rho is a good idea. And, sorry about the
error from XrayDB in the released version. This is now fixed in github.
I've been playing with normalization with tabulated mu/rho with the MBACK
algorithm. I think there are potential issues with this, in that MBACK
includes both a pre-edge that tries to compensate for Compton scattering
leaking into the fluorescence signal *and* normalization using tabulated
mu/rho. Especially when using a Victoreen pre-edge, I think that the
compensation for Compton scattering can sort of cause instabilities, though
I haven't explored this for a wide range of spectra.
But I recently (like, in the past week) added a "mback_norm" function to do
only the normalization using tabulated mu/rho. This is now in the github
master branch and partially supported in the github-version of
XAS_Viewer. But, this definitely needs more study and more work.
If you're interested in looking at this in more detail, let me know or
check out the github master repo.
Or, if you're more interested in the wavelet transforms, please work on
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ifeffit