Hi George, 



On Mon, May 4, 2020 at 12:25 PM George Sterbinsky <GeorgeSterbinsky@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?

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.

I can definitely believe that there is some loss of precision when copy parameters from "best fit" values.

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.

--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)

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).