Re: [Ifeffit] fitting of S XANES with arctans and gaussians

2016-07-19 Thread Matt Newville
On Tue, Jul 19, 2016 at 6:38 AM, Jon Wade  wrote:

>
> I can’t recommend  LMFIT in python enough  (or Larch - never used it mind,
> but see no reason why I haven’t).
>
> Its well documented, easy to use and, best of all, its FREE!  :)
>
>
> https://lmfit.github.io/lmfit-py/builtin_models.html#builtin-models-chapter
>
> https://lmfit.github.io/lmfit-py/builtin_models.html#example-3-fitting-multiple-peaks-and-using-prefixes
>
>
> all the best
>
> Jon
>
>
There are (IMHO) pretty good peak fitting methods in Larch, and a GUI for
fitting XANES with Larch and LMFIT is actually a top priority for me. It's
in progress (I was working on it some yesterday), but not yet fully
working.  This will allow features like constraining multiple peaks to have
the same widths, etc.

Feature requests, suggestions, or help are most welcome.

--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] fitting of S XANES with arctans and gaussians

2016-07-19 Thread Jon Wade
I can’t recommend  LMFIT in python enough  (or Larch - never used it mind, but 
see no reason why I haven’t).

Its well documented, easy to use and, best of all, its FREE!  :)


https://lmfit.github.io/lmfit-py/builtin_models.html#builtin-models-chapter
https://lmfit.github.io/lmfit-py/builtin_models.html#example-3-fitting-multiple-peaks-and-using-prefixes


all the best

Jon



On 19 Jul 2016, at 14:26, Robert Gordon 
mailto:ragor...@alumni.sfu.ca>> wrote:

Hi Matthew,

WinXAS, (Commercial program by Thorsten Ressler) does possess the capabilities 
you are seeking
but it costs E$200 for an academic/gov't license.

-R.



___
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

___
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] fitting of S XANES with arctans and gaussians

2016-07-19 Thread Robert Gordon

Hi Matthew,

WinXAS, (Commercial program by Thorsten Ressler) does possess the 
capabilities you are seeking

but it costs E$200 for an academic/gov't license.

-R.

On 7/19/2016 5:21 AM, Bruce Ravel wrote:

On 07/18/2016 11:10 PM, Matthew Marcus wrote:

I'm trying to fit 37 micro-XANES spectra taken at the S K-edge, using
the method discussed in the paper by Manceau and Nagy "Quantitative
analysis of sulfur functional groups
in natural organic matter by XANES spectroscopy", Geochimica et
Cosmochimica Acta 99 (2012) 206–223.  In this paper, they fit spectra to
two arctangents and 6 gaussians,
with widths of the arctans slaved together and widths of gaussians 1-3
and 4-6 slaved (or all 6 to one value).  I'm looking for recommendations
as to how to do the fit.
They give prescriptions for how to set the initial estimates to give
robust values.  Manceau has told me that 'Athena works quite well', but
I don't see any obvious way there
to do the parameter constraints called for, or to keep peak heights from
going negative.  Athena also has a habit of assuming you want it to do
the normalization
for you; I've already done that and need no further 'help'.  Any ideas?


Matthew,

As for the pre-normalized data, you are supposed to be able to tell 
Athena at the time of import that the data are normalized mu(E).


http://bruceravel.github.io/demeter/documents/Athena/import/columns.html#data-types-and-energy-units 



If that doesn't work, let me know.

As for constraints in the peak fitting, that is certainly not 
implemented in Athena.  I am not quite sure why Alain thinks otherwise.


HTH,
B





___
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] fitting of S XANES with arctans and gaussians

2016-07-19 Thread Bruce Ravel

On 07/18/2016 11:10 PM, Matthew Marcus wrote:

I'm trying to fit 37 micro-XANES spectra taken at the S K-edge, using
the method discussed in the paper by Manceau and Nagy "Quantitative
analysis of sulfur functional groups
in natural organic matter by XANES spectroscopy", Geochimica et
Cosmochimica Acta 99 (2012) 206–223.  In this paper, they fit spectra to
two arctangents and 6 gaussians,
with widths of the arctans slaved together and widths of gaussians 1-3
and 4-6 slaved (or all 6 to one value).  I'm looking for recommendations
as to how to do the fit.
They give prescriptions for how to set the initial estimates to give
robust values.  Manceau has told me that 'Athena works quite well', but
I don't see any obvious way there
to do the parameter constraints called for, or to keep peak heights from
going negative.  Athena also has a habit of assuming you want it to do
the normalization
for you; I've already done that and need no further 'help'.  Any ideas?


Matthew,

As for the pre-normalized data, you are supposed to be able to tell 
Athena at the time of import that the data are normalized mu(E).


http://bruceravel.github.io/demeter/documents/Athena/import/columns.html#data-types-and-energy-units

If that doesn't work, let me know.

As for constraints in the peak fitting, that is certainly not 
implemented in Athena.  I am not quite sure why Alain thinks otherwise.


HTH,
B



--
 Bruce Ravel   bra...@bnl.gov

 National Institute of Standards and Technology
 Synchrotron Science Group at NSLS-II
 Building 743, Room 114
 Upton NY, 11973

 Homepage:http://bruceravel.github.io/home/
 Software:https://github.com/bruceravel
 Demeter: http://bruceravel.github.io/demeter/
___
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


[Ifeffit] fitting of S XANES with arctans and gaussians

2016-07-18 Thread Matthew Marcus

I'm trying to fit 37 micro-XANES spectra taken at the S K-edge, using the method 
discussed in the paper by Manceau and Nagy "Quantitative analysis of sulfur 
functional groups
in natural organic matter by XANES spectroscopy", Geochimica et Cosmochimica 
Acta 99 (2012) 206–223.  In this paper, they fit spectra to two arctangents and 6 
gaussians,
with widths of the arctans slaved together and widths of gaussians 1-3 and 4-6 
slaved (or all 6 to one value).  I'm looking for recommendations as to how to 
do the fit.
They give prescriptions for how to set the initial estimates to give robust 
values.  Manceau has told me that 'Athena works quite well', but I don't see 
any obvious way there
to do the parameter constraints called for, or to keep peak heights from going 
negative.  Athena also has a habit of assuming you want it to do the 
normalization
for you; I've already done that and need no further 'help'.  Any ideas?

I've tried using Genplot, but that offers no way to restrain parametsrs to 
ranges to keep them from going nuts.

PCA seems to want 6-8 components, so it's not all that helpful.  These spectra 
were taken at various spots on a biological structure (abalone radula) so 
there's
no sense of sequence which would enable the use of evolving factor analysis or 
something like that.  LCF doesn't give satisfying fits with the references I 
have.

I've attached a couple of the files, truncated to the range Manceau&Nagy fit 
to.  The originas were taken over the range 2460-2550eV.
mam
2459.8733   0.016383041
2460.1233   0.016094189
2460.3735   0.022025956
2460.6238   0.016678091
2460.8738   0.01631
2461.1240.019483142
2461.3743   0.01770903
2461.6245   0.022848981
2461.8745   0.018562062
2462.1248   0.020740321
2462.3748   0.020652939
2462.6250.017123673
2462.8752   0.025094582
2463.1252   0.019867383
2463.3755   0.022139577
2463.6257   0.023213524
2463.8757   0.020676881
2464.1260.025052877
2464.3762   0.029113997
2464.6262   0.026324339
2464.8765   0.023671083
2465.1267   0.028306101
2465.3767   0.026002042
2465.6270.030652333
2465.8772   0.028775895
2466.1272   0.032816786
2466.3774   0.033937715
2466.6277   0.032948535
2466.8777   0.034721162
2467.1279   0.035310403
2467.3782   0.044202648
2467.6282   0.038343795
2467.8784   0.044291645
2468.1287   0.045460965
2468.3787   0.051915355
2468.6289   0.064561076
2468.8789   0.064293481
2469.1292   0.06745372
2469.3794   0.076904655
2469.6294   0.078936517
2469.8794   0.083785988
2470.1292   0.09224768
2470.3789   0.10311307
2470.6287   0.12705681
2470.8784   0.15507881
2471.1279   0.19775756
2471.3777   0.24674262
2471.6274   0.38095856
2471.8772   0.61600226
2472.1270.95312738
2472.3767   1.3190417
2472.6262   1.579319
2472.8761.6359525
2473.1257   1.5544981
2473.3755   1.4989064
2473.6252   1.5021619
2473.8751.5229028
2474.1245   1.4984316
2474.3743   1.3305453
2474.6241.0569189
2474.8738   0.83871508
2475.1235   0.74043173
2475.3733   0.70619929
2475.6228   0.73935717
2475.8726   0.8194145
2476.1223   0.87513489
2476.3721   0.88144314
2476.6218   0.90261424
2476.8716   0.89132398
2477.1211   0.89018643
2477.3708   0.8967182
2477.6206   0.90281725
2477.8704   0.94701087
2478.1201   0.94702822
2478.3699   0.97867304
2478.6194   1.0008969
2478.8691   1.0092386
2479.1189   1.0287796
2479.3687   1.08442
2479.6184   1.1615053
2479.8679   1.3039225
2480.1179   1.5145243
2480.3674   1.797269
2480.6172   2.0798359
2480.8669   2.2775149
2481.1167   2.3608608
2481.3662   2.3488405
2481.6162.2907579
2481.8657   2.2880797
2482.1155   2.3719938
2482.3652   2.5308979
2482.6152.589304
2482.8645   2.5814075
2483.1143   2.3856504
2483.3642.1799946
2483.6138   1.9504212
2483.8635   1.7527013
2484.1133   1.5563732
2484.3628   1.4446132
2484.6125   1.3397398
2484.8623   1.2488514
2485.1121   1.2062074
2485.3618   1.141425
2485.6116   1.1280848
2485.8611   1.0882412
2486.1108   1.0844127
2486.3606   1.0722013
2486.6104   1.0759245
2486.8601   1.050091
2487.1099   1.0626349
2487.3596   1.0662534
2487.6091   1.0521868
2487.8589   1.0660895
2459.8232   0.0086620357
2460.0735   0.0090417974
2460.3235   0.033545561
2460.5737   0.0085842237
2460.8240.0051017846
2461.0740.011186908
2461.3242   0.017373042
2461.5742   0.015282798
2461.8245   0.020608777
2462.0747   0.030159647
2462.3247   0.037008617
2462.5750.019812036
2462.8250.017694598
2463.0752   0.021219229
2463.3252   0.025639383
2463.5754   0.