-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Atan and Erf baseline models for pre-edge peak fitting #558
Comments
@maurov -- yes, we could add an arc-tan and error function for baselines. The "Other Models" dropdown list does have arc-tan and error-function step functions. So... perhaps the best thing to do is to have a separate "General Peak Fitting" Tab that doesn't do the sort of weird "pre-edge peak baseline" thing, and just assumes: Fit this X/Y or E/Mu curve as a sum of model components. |
@maurov Constant + ArcTan Step and Constant + Error Function Step and now available as baseline models. |
@newville thanks for your comments and quickly implementing this. I think that the Pre-edge Peaks tab could be renamed to Peak fitting. I do not find weird the "baseline fit workflow", but very helpful for non experts. In most peak fitting there is a baseline to fit first and add components later. What I would suggest changing in this workflow is too fix the fitted baseline parameters, such that are not changed when one clicks on "fit current group". By the way, I found a bug: when changing from the "XAS Normalization" tab to the "Pre-edge Peaks" tab, the "Fit X/Energy Range" is changed back to default. The expected behavior is that this energy range, when manually changed, it stay fixed (should be saved also in the session file). Furthermore, we should also extend the documentation of the peak fitting feature of Larix. Going back to the ArcTan/ErrorFunction Step models, I gave a try and I realized that the definition of StepModel in Lmfit is too steep for XAS. I was not able to get a good fit of the data above with such baseline models. Even by strongly changing the initial guess values by hand, they converge to very steep results. Here a comparison of the two behaviours:
IMHO, the definition I gave above works much better and I would propose implementing it in larch. What do you think? |
@maurov Thanks -- I'll look into the ranges when switching from XAS Normalization to Pre-edge Peak. I'm not sure what is happening there for the arc-tangent fit. It should completely ignore the data in the "Baseline Skip Range" (between the light gray lines). |
@newville I usually get a request for having an arctangent-like baseline model for the pre-edge peak fitting in Larix. I think this is justified for tender X-ray energy range, light-elements K-edges (like Sulphur) or 4d transition metals. Furthermore, for HERFD XAS is useful having an error function (erf) baseline.
Here an example of how I successfully define and use such baselines in Fityk:
The example above is given for Mn K-edge, but the
step
ande0
can be easily guessed automatically for the input XAS spectrum.width
can stay 1 by default.Since you are the lmfit and Larix master, would it be possible for you to to add the above functions to the pre-edge peaks panel in Larix? Otherwise I will implement it by myself, even if it will require me more time to get into the Wx technicalities.
Below I paste an example for S K-edge done, respectively, with Fityk using arctangent and Larix using constant+Lorentzian as baseline
The text was updated successfully, but these errors were encountered: