[Ifeffit] Change in fixed baseline after fit in XAS Viewer

George Sterbinsky GeorgeSterbinsky at u.northwestern.edu
Mon May 11 14:19:11 CDT 2020


Hi Matt and All,

While running more pre-edge baseline fits, I made some observations that
may be additionally helpful in resolving this issue. XAS Viewer is happy to
run "fit baseline" with eight significant digits for all five baseline fit
parameters. However, for some reason when running "fit model", the fit
parameters are rounded to the sixth decimal place. I have attached some
screenshots of another fit to illustrate this. The rounding of values to
the 6th decimal place results in only four of the original eight
significant digits being retained for bline_slope and six of eight for
bpeak_sigma, as shown in the screenshot of the Fit Results window. The
original values of bline_slope and bpeak_sigma from the baseline fit can be
seen in the two screenshots of the Larch GUI window. The other three fit
parameters did not have significant digits after the sixth decimal, and all
eight significant digits were retained for those parameters after running
"fit model". Let me know if any additional information would be helpful.

Thanks,
George



On Mon, May 4, 2020 at 11:07 PM George Sterbinsky <
GeorgeSterbinsky at u.northwestern.edu> wrote:

> Hi Matt,
>
> Thanks for the reply.
>
> On Mon, May 4, 2020 at 3:04 PM Matt Newville <newville at cars.uchicago.edu>
> wrote:
>
>> Hi George,
>>
>>
>>
>> On Mon, May 4, 2020 at 12:25 PM George Sterbinsky <
>> GeorgeSterbinsky at u.northwestern.edu> wrote:
>>
>>> Hello,
>>>
>>> I have observed changes in fixed parameters while running a pre-edge
>>> peak fit in XAS Viewer. I first run a baseline fit. This provides a good
>>> match to the data in the baseline fitting region. I would like to subtract
>>> the baseline from the data and then numerically integrate the data. In
>>> order to export the baseline fit and data, I fix all of the fitting
>>> parameters for bline and bpeak and then click "fit model". This generates a
>>> baseline and fit that no longer match the data well in the baseline fitting
>>> region. Additionally, in the "Fit Results" window, the reported best-fit
>>> values of the fixed parameters are slightly different from the values
>>> reported in the "Value" field after the baseline fit, to which they were
>>> fixed. This appears to be the result of rounding of the baseline fit
>>> parameters at some point after the baseline fit. For example bline_slope
>>> was fixed to "-0.0024752483" but the best-fit value is "-0.00247500". I
>>> realize I am using XAS Viewer in a way that it was not exactly designed
>>> for, and perhaps no one anticipated someone fixing a parameter out to 10
>>> decimal places. However, what I am doing still seems reasonable, and I
>>> would greatly appreciate it if XAS Viewer could be updated so that all
>>> digits entered in the Value field for a fixed parameter will be maintained
>>> for the fit. I am happy to provide a project file and instructions to
>>> reproduce my observation if they would be helpful.
>>>
>>>
>> When you do "Fit Model", the fit will not ignore the "pre-edge peak
>> range".   So, if you just have a baseline, that could definitely change the
>> resulting baseline "Lorentzian + Line". Could that be what you're seeing?
>>
>
> I have fixed all fit parameters after the baseline fit was carried out, so
> nothing is actually getting fit when I hit the "fit model" button. I just
> want to export the baseline fit. By fixing all of the parameters and then
> running "fit model", I'm just getting the "Fit Results" window to open.
> From there, I can then export the "fit" as an xdi file.
>
>
>> FWIW, it should definitely be possible to fix the baseline (even if that
>> might not always be ideal) parameters after just fitting the baseline.  It
>> seems like that works to me, but I only tried for one test case.
>>
>
> Yes, it seems to work except for the loss of precision.
>
>
>> I can definitely believe that there is some loss of precision when copy
>> parameters from "best fit" values.
>>
>
> The loss of precision occurs when the numbers from the baseline fit are
> transferred to the best fit. In other words, when copying the values to the
> best fit, rather than from the best fit. To illustrate this, I have
> attached a screenshot of the main larch GUI after the baseline fit that
> shows the precision of bline_slope and bline_intercept. I have also
> attached a screenshot of the plot window showing the baseline matches the
> data well in fit region. After fixing all bline and bpeak parameters and
> pressing "fit model", the values of bline_slope and bline_intercept (as
> well as those of the bpeak parameters) lose precision, as shown in the
> attached screenshot of the "fit results" window. The effect of this is also
> evident in the attached data plot after the fit model button was pressed.
> The baseline no longer matches the data well. Again, all fit parameters
> were fixed, so the baseline before the fit should look identical to the
> baseline after the fit.
>
>
>> It might be helpful to extract the extra-verbose Larch script (Ctrl-l to
>> bring up the Larch buffer, the Ctrl-s to save the session history) and send
>> that.
>>
>
> I have saved the history and attached it as "history.lar".
>
>
>> --Matt
>>
>> PS: I can also see that it would be nice to report things like
>>
>>    Area of data, Area of data - baseline, Area of Peaks (other than
>> baseline)
>>
>
> Yes, that would be nice. But if one wanted only a baseline fit and the
> area of data - baseline, I think the precision issue I am encountering now
> might still present a problem. Actually my goal here is to get the centroid
> of the data minus the baseline so that I can compare it with the centroids
> of various fit models that I have tried, which are different enough to make
> me wonder which one is 'correct.' Since the baseline is fit along with the
> peaks, I didn't really want to use the baseline from one of the pre-edge
> peak fits for this. I want to use the baseline from the baseline fit.
>
>
>>
>> in addition to Peak centroid.   The Area of the Peaks is just the sum of
>> the peak amplitudes (as the peak functions are all unit normalized), but it
>> would be nicer to do that in a way that included the propagation or
>> uncertainties (including correlations).
>>
>
> Yes, I actually noticed that when looking at the forms of the fit
> functions at https://xraypy.github.io/xraylarch/fitting/lineshapes.html
> and have been taking advantage of it.
>
> Thanks for your help,
>
> George
>
>
>
>
>> _______________________________________________
>> Ifeffit mailing list
>> Ifeffit at millenia.cars.aps.anl.gov
>> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
>> Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://millenia.cars.aps.anl.gov/pipermail/ifeffit/attachments/20200511/0e18d10d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LarchGUIwindow_blineTab.png
Type: image/png
Size: 742407 bytes
Desc: not available
URL: <http://millenia.cars.aps.anl.gov/pipermail/ifeffit/attachments/20200511/0e18d10d/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FitResultsWindow.png
Type: image/png
Size: 639045 bytes
Desc: not available
URL: <http://millenia.cars.aps.anl.gov/pipermail/ifeffit/attachments/20200511/0e18d10d/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LarchGUIwindow_bpeakTab.png
Type: image/png
Size: 787988 bytes
Desc: not available
URL: <http://millenia.cars.aps.anl.gov/pipermail/ifeffit/attachments/20200511/0e18d10d/attachment-0005.png>


More information about the Ifeffit mailing list