Re: [Ifeffit] xraylarch

2022-08-06 Thread Matt Newville
Hi Paul,

On Fri, Aug 5, 2022 at 8:41 AM Paul Fons  wrote:

> Hi.
>   Due to the difficulties of getting demeter to work on the Apple M1
> machines, I have started to use xraylarch and so far I like the interface
> as well as the possibility of scripting later on. I had a couple of
> observations and a question regarding xraylarch usage that I hope could be
> addressed here.
>
>
Thanks -- I gave some short answers to this at Github, but I thought I
would respond here too, as there might be people with thoughts on this
stuff here.

First, one can load multiple spectra into the (feff) fitting window. It
> seems, however, that which paths are selected are universal (the selected
> paths are used for all exafs spectra). Does this mean that multiple edge
> fitting is not possible. If multiple edge fitting is possible, how is it
> done?
> In the fitting window, one can have several spectra loaded and one can
> select all or some of the spectra to be fit. The interface seems like it
> was designed for multiple edge fitting, but is it?
>

Right now - and maybe for a while - the XAS Viewer GUI only supports
fitting 1 data set at a time. My view is kind of that "a GUI for simple
stuff, and scripts for complex stuff" is a reasonable starting point. But
also, fitting 1 data set at a time is just more complicated and harder to
expose as a GUI. Suggestions welcome!


> Second, it is strange that whenever a parameter is changed that the
> fitting variable settings (fixed, vary, constrain) are reset. For complex
> fits, this generates a lot of unnecessary clicking (and the corresponding
> mistake possibilities)
>

Yes, I agree.  I think this can be better (and a few things in this area have
been updated in the devel version). Having others using this in recent
short courses also showed similar problems, including when using >8 paths
and using many variables.  It's still kind of a work in progress and this
kind of feedback is really helpful.



> Third, when one reads in several different feff calculations, one would,
> in principle, like to have a different value of e0 (the origin of energy
> offset) for each feff calculation. By default when a feff calculation is
> read in the variable e0 is defined. When one defines alternative energy
> offset variables for the different feff calculations and deletes the
> original e0 value, something strange happens. Accessing the “Edit
> Parameters” window results in e0 reappearing (even though it has been
> manually deleted previously). Is this a feature? The same thing may happen
> for other “automatic” variables as well.
>
>

First, yes it does look like a bug that XAS Viewer insists on having
Parameters named "e0" and "s02". Will investigate, hopefully pushing a fix
in a month or so...

Second, I think that creating a different "e0" for each Feff run is a good
idea.

In fact, it would probably be reasonable to read the "Vint" value from the
feff.dat file and use "E0 Path Parameter = vint + e0_feff_run". vint
could even be (like Reff) a per-path variable, and the variable for E0
could be (by default) the same for all paths from a single Feff run, but
different for different Feff runs.

I think there are no clear results on whether using the value of
per-feff-run vint was good enough to make a single e0 variable really
independent of the Feff run.  I do believe that the values for vint are
pretty good with Feff8, but It would be interesting to try to figure out
how to test this well.   If you or anyone else has an opinion or thoughts on
any of this, that would be valuable.


Four. This is really a feature request. When a variable is unused (lets say
> some additional paths are introduced in the fitting process and a new fit
> without them is attempted), the choices in the parameter list are (fix,
> vary, and constrain). There is no option to “skip” like in Artemis.
> Obviously, one can choose fix, but in doing so the unused variable shows up
> in the fit result summary and is somewhat confusing. It would be
> subjectively better to have the option to “skip” a variable and not have it
> show up in the fit summary.
>

Another good point: Skip is a good option to have and doing "set to Skip"
instead of "set to Fixed" would be a reasonable thing for XAS_Viewer to do
for "unused parameters".  On the To Do list now!


>
> Just some initial thoughts...
>

Thanks very much!

--Matt
___
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


Re: [Ifeffit] Parameters for parent function in wavelet transform analysis

2022-08-06 Thread Xinyu Luo
Hello Scott,

  Thanks! I actually have the same question. I'm a graduate student. I learned 
the wavelet transform from the website of ESRF (and I learned XAFS from your 
book!). I can share my opinions on this question.

  There is a mother wavelet called cauchy [Muñoz, M.et al, Am. Mineral. 2003, 
88 (4), 694], which seems to be pretty nice because only one parameter used to 
manipulate the resolution---n. And that's where I started. After reading more 
literatures and I was taught that wavelet analysis can be more powerful if the 
mother function looks more like to the path of interested. So probably, the two 
parameters of Morlet can be used to ,mimic the path of interest generated by 
FEFF. I wrote an email before to ask about how to realize the steps described 
in a literature[Funke, H. et al, J. Synchrotron Radiat. 2007, 14 (5), 426]. You 
can see that they customized a mother function on the base of FEFF to surpass 
the resolution of Morlet. If I understand it correctly, the uncertainty limit, 
though which is a law in physics, can't be compared on different Mother 
functions. And go back to your question, perhaps you can an optimized choice of 
sigma and eta with a fixed (sigma)(eta). BUT I DON'T KNOW HOW TO GET THAT. It's 
clumsy to try a bunch of value and I hope someone can teach me on how to choose 
a starting value of sigma, or eta.




Best

Xinyu



-Original Messages-
From:"Scott Calvin" 
Sent Time:2022-08-06 01:41:17 (Saturday)
To: ifeffit@millenia.cars.aps.anl.gov
Cc:
Subject: [Ifeffit] Parameters for parent function in wavelet transform analysis

Hi all,


I’ve never actually tried wavelet transform analysis before, so I’m trying to 
understand it better, but there’s one aspect that’s puzzling me:


The Morlet wavelet has two parameters, eta and sigma. Eta controls how fast it 
wiggles, and sigma how quickly the function dies out. (Essentially, it’s like 
the basis function for a Fourier transform multiplied by a Gaussian envelope.)


In wavelet analysis we pick a parent function, which is often a Morlet wavelet 
with particular values of eta and sigma that we have chosen. 


We then create a set of child functions from the parent function by shifting 
and dilating the function in k-space.


Each child function is then used as a basis function for a transform of chi(k) 
calculated by integrating over a range of k-values, much like what is done to 
calculate a Fourier transform. Since the Morlet wavelet is localized in 
k-space, and the child functions are shifted to focus on different regions of 
k-space, our wavelet transform produces plots which are a function of k. But 
since dilating the parent function by different amounts yields child functions 
with different frequencies, the plots are also a function of R. Therefore the 
result is a two-dimensional (k and R) contour plot.


So far, so good. 


But what I’m wondering about is the effect of the initial choice of eta and 
sigma for the parent function.


The dimensionless product of eta and sigma has a clear effect. If (eta)(sigma) 
is small, the parent function will not have very many oscillations of 
significant size; it it’s large, it will have a lot of oscillations. So if we 
want good resolution in R (and thus relatively poor resolution in k), we want a 
big value of (eta)(sigma). In the limit as (eta)(sigma) becomes arbitrarily 
large, we recover the Fourier transform. If we want good resolution in k, we 
use a small value for (eta)(sigma). In the limit as (eta)(sigma) becomes 
arbitrarily small we recover chi(k).


That still makes sense to me!


But what difference do sigma and eta make individually? In other words, how is 
sigma = 0.5 and eta = 10.0 different from sigma = 1.0 and eta = 5.0? Since we 
end up creating child functions that dilate the parent function anyway, I can’t 
see that it should have any effect at all. 


And if those two parameters don’t make an independent effect, why do we pretend 
there are two independent-looking parameters? 


I’ve seen at least one early paper that suggests choosing eta so that it’s 
close to the path length you’re most interested in probing, but I can’t see how 
that actually makes any difference, given the dilation.


I expect there’s a good chance I’m missing something obvious, or have a 
fundamental misunderstanding of part of the process, and look forward to 
learning more!


Best,


Scott Calvin
Lehman College of the City University of New York

___
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