Problem with XAS Viewer
Hi, I am Xinyue, a student who interested in using XAS Viewer. My issue is when I tried baseline fitting, I followed the document. But there was no region, no centroid, and no fitting line shown. Here is a screenshot of my work. Could you please help me with this? Thanks for your help. Thanks, Xinyue
Hi Xinyue,
On Fri, May 1, 2020 at 9:16 PM Xinyue Wang
Hi,
I am Xinyue, a student who interested in using XAS Viewer. My issue is when I tried baseline fitting, I followed the document. But there was no region, no centroid, and no fitting line shown. Here is a screenshot of my work. Could you please help me with this? Thanks for your help.
From your screenshot, I don't see much of a pre-edge and not many obvious
It's hard to tell from the screenshot alone. Just to clarify, the idea for the panel is to fit pre-edge peaks to known lineshapes (Gaussian, Lorentzian, Voigt, etc). The interface could probably be used for general-purpose curve-fitting of many kinds of spectra, but right now it definitely skews to pre-edge peak fitting. Because of that emphasis, the idea is to first press the "Fit Baseline" button -- this will do a crude fit of a Lorentzian + Line that are meant to represent any residual background and the main absorption edge. The fit for this baseline is done over the energy range defined by "Fit Energy Range" but ignoring the "Pre-edge Peak Range", which is meant to be the portion of the XAS spectra where the pre-edge peaks are. That is, this baseline fit should look something like Figure 5.4.2 at https://xraypy.github.io/xraylarch/xasviewer/index.html#pre-edge-peak-fittin.... In that figure, the black dots show the ends of the Pre-edge Peak Range that is ignored in this baseline fit. For sure, the initial guess for this range may not be very good. But it is easy to refine this ignored range. It is also not actually critical to get this baseline fit perfect - it's just a place to start the fits of the peaks themselves, and the remaining fits will refine the baseline as well as the peaks over the full energy range. After a baseline fit is done, you can add peaks and then use the "Fit Model", which fits over the whole "Fit Energy Range", ignoring the "Pre-edge Peak Range". peaks. The result is that the actual fit energy range for the baseline (that is "Fit Energy Range" - "Pre-edge Peak Range") is very short. I can believe the fit will fail under those conditions. But I sort of think that failure really comes because your data doesn't have pre-edge peaks. Maybe you are trying to do something more complicated? --Matt
Hi Matt,
Thanks for your detailed instructions. I am just trying to follow the steps
and see how it works. I am not trying to do complicated things.
My issue is I would expect the grey vertical lines after press the "Fit
Baseline" button, but nothing shows up. I tried to select a
larger region(which was not pre-peak), also nothing happened. So I am
confused.
Besides, can I use the XAS Viewer to do main peak fitting?
I know that Larch has its own language based on python. I am wondering can
I use larch function, like fitting peaks in Jupiter Notebook?
Thanks for your help.
Thank,
Xinyue
On Sat, May 2, 2020 at 6:36 AM Matt Newville
Hi Xinyue,
On Fri, May 1, 2020 at 9:16 PM Xinyue Wang
wrote: Hi,
I am Xinyue, a student who interested in using XAS Viewer. My issue is when I tried baseline fitting, I followed the document. But there was no region, no centroid, and no fitting line shown. Here is a screenshot of my work. Could you please help me with this? Thanks for your help.
It's hard to tell from the screenshot alone. Just to clarify, the idea for the panel is to fit pre-edge peaks to known lineshapes (Gaussian, Lorentzian, Voigt, etc). The interface could probably be used for general-purpose curve-fitting of many kinds of spectra, but right now it definitely skews to pre-edge peak fitting.
Because of that emphasis, the idea is to first press the "Fit Baseline" button -- this will do a crude fit of a Lorentzian + Line that are meant to represent any residual background and the main absorption edge. The fit for this baseline is done over the energy range defined by "Fit Energy Range" but ignoring the "Pre-edge Peak Range", which is meant to be the portion of the XAS spectra where the pre-edge peaks are. That is, this baseline fit should look something like Figure 5.4.2 at https://xraypy.github.io/xraylarch/xasviewer/index.html#pre-edge-peak-fittin.... In that figure, the black dots show the ends of the Pre-edge Peak Range that is ignored in this baseline fit. For sure, the initial guess for this range may not be very good. But it is easy to refine this ignored range. It is also not actually critical to get this baseline fit perfect - it's just a place to start the fits of the peaks themselves, and the remaining fits will refine the baseline as well as the peaks over the full energy range. After a baseline fit is done, you can add peaks and then use the "Fit Model", which fits over the whole "Fit Energy Range", ignoring the "Pre-edge Peak Range".
From your screenshot, I don't see much of a pre-edge and not many obvious peaks. The result is that the actual fit energy range for the baseline (that is "Fit Energy Range" - "Pre-edge Peak Range") is very short. I can believe the fit will fail under those conditions. But I sort of think that failure really comes because your data doesn't have pre-edge peaks.
Maybe you are trying to do something more complicated?
--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
On Sat, May 2, 2020 at 3:18 PM Xinyue Wang
Hi Matt,
Thanks for your detailed instructions. I am just trying to follow the steps and see how it works. I am not trying to do complicated things. My issue is I would expect the grey vertical lines after press the "Fit Baseline" button, but nothing shows up. I tried to select a larger region(which was not pre-peak), also nothing happened. So I am confused.
From what I saw of your screenshot (not much to go on, really), it was not obvious that your data has much (possibly "any") pre-edge data. It also shows as "scaled y" vs "x", which suggests that the data wasn't even read in as XAS data.
Besides, can I use the XAS Viewer to do main peak fitting?
Well, I guess another way to put that is: yes, you probably can use XAS Viewer to do general-purpose peak-fitting. It is not really designed for that, but you might be able to make that work. If that is what you want to do. Is that what you are trying to do? I know that Larch has its own language based on python. I am wondering can
I use larch function, like fitting peaks in Jupiter Notebook?
You can use larch as a Python library, or use the lmfit Python library to do the fitting. Some Larch functionality, notably the plotting and GUI aspects, may not work well from a Jupyter notebook. If you're using Python or Jupyter notebook, you probably don't really need to use the Larch language for most XAS processing and analysis functionality. Hope that helps, --Matt PS: I should say that if one is really doing Feff-based fitting with `feffit()`, it is still really, really helpful to create a `larch.Interpreter()` and pass that around to all of the corresponding functions. Over the past year or so, this requirement has been removed from most of the Larch functions but the functions for doing Feff-based fitting are more intertwined and so keep some "state information" within a "session". But that seems separate from the question here.
Hi Matt,
Thanks! That is really helpful! I just realized that I should change the
raw data to XAS.
Thanks,
Xinyue
On Sun, May 3, 2020 at 6:22 AM Matt Newville
On Sat, May 2, 2020 at 3:18 PM Xinyue Wang
wrote: Hi Matt,
Thanks for your detailed instructions. I am just trying to follow the steps and see how it works. I am not trying to do complicated things. My issue is I would expect the grey vertical lines after press the "Fit Baseline" button, but nothing shows up. I tried to select a larger region(which was not pre-peak), also nothing happened. So I am confused.
From what I saw of your screenshot (not much to go on, really), it was not obvious that your data has much (possibly "any") pre-edge data. It also shows as "scaled y" vs "x", which suggests that the data wasn't even read in as XAS data.
Besides, can I use the XAS Viewer to do main peak fitting?
Well, I guess another way to put that is: yes, you probably can use XAS Viewer to do general-purpose peak-fitting. It is not really designed for that, but you might be able to make that work. If that is what you want to do. Is that what you are trying to do?
I know that Larch has its own language based on python. I am wondering can
I use larch function, like fitting peaks in Jupiter Notebook?
You can use larch as a Python library, or use the lmfit Python library to do the fitting. Some Larch functionality, notably the plotting and GUI aspects, may not work well from a Jupyter notebook.
If you're using Python or Jupyter notebook, you probably don't really need to use the Larch language for most XAS processing and analysis functionality.
Hope that helps,
--Matt
PS: I should say that if one is really doing Feff-based fitting with `feffit()`, it is still really, really helpful to create a `larch.Interpreter()` and pass that around to all of the corresponding functions. Over the past year or so, this requirement has been removed from most of the Larch functions but the functions for doing Feff-based fitting are more intertwined and so keep some "state information" within a "session". But that seems separate from the question here.
_______________________________________________ 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
Hi Matt,
I am trying to fit the main peak. So, to do the general peak fitting,
should I use the pre-edge peak tab in XAS viewer or other tab?
Thanks for your help.
Thanks,
Xinyue
On Sun, May 3, 2020 at 6:22 AM Matt Newville
On Sat, May 2, 2020 at 3:18 PM Xinyue Wang
wrote: Hi Matt,
Thanks for your detailed instructions. I am just trying to follow the steps and see how it works. I am not trying to do complicated things. My issue is I would expect the grey vertical lines after press the "Fit Baseline" button, but nothing shows up. I tried to select a larger region(which was not pre-peak), also nothing happened. So I am confused.
From what I saw of your screenshot (not much to go on, really), it was not obvious that your data has much (possibly "any") pre-edge data. It also shows as "scaled y" vs "x", which suggests that the data wasn't even read in as XAS data.
Besides, can I use the XAS Viewer to do main peak fitting?
Well, I guess another way to put that is: yes, you probably can use XAS Viewer to do general-purpose peak-fitting. It is not really designed for that, but you might be able to make that work. If that is what you want to do. Is that what you are trying to do?
I know that Larch has its own language based on python. I am wondering can
I use larch function, like fitting peaks in Jupiter Notebook?
You can use larch as a Python library, or use the lmfit Python library to do the fitting. Some Larch functionality, notably the plotting and GUI aspects, may not work well from a Jupyter notebook.
If you're using Python or Jupyter notebook, you probably don't really need to use the Larch language for most XAS processing and analysis functionality.
Hope that helps,
--Matt
PS: I should say that if one is really doing Feff-based fitting with `feffit()`, it is still really, really helpful to create a `larch.Interpreter()` and pass that around to all of the corresponding functions. Over the past year or so, this requirement has been removed from most of the Larch functions but the functions for doing Feff-based fitting are more intertwined and so keep some "state information" within a "session". But that seems separate from the question here.
_______________________________________________ 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
On Mon, May 4, 2020 at 12:55 PM Xinyue Wang
Hi Matt,
I am trying to fit the main peak. So, to do the general peak fitting, should I use the pre-edge peak tab in XAS viewer or other tab? Thanks for your help.
What sort of model do you want to use to fit the main peak? If you want to fit it with some pre-defined line shapes (arctan, Gaussians, etc), then the pre-peak tab might be able to do that. As I mentioned earlier, you'll have to start with "fit baseline" to get started even though it is basically inappropriate, and then modify the model. I should say that I'm not entirely sure that fitting in this way is really what you want to do, but maybe you have some ideas about that is the approach you want to use. --Matt
participants (2)
-
Matt Newville
-
Xinyue Wang