Julian-Hochhaus / LG4X-V2

A graphical user interface of Python lmfit package was developed for standard X-ray photoemission spectroscopy (XPS) curve fitting analysis. The interface streamlines the fitting procedures for validating results and their consistency.
https://julian-hochhaus.github.io/LG4X-V2/
Other
20 stars 9 forks source link

Tick box to fixed value for Lorentzian does not fixed the value. #94

Closed kevinsmia1939 closed 1 year ago

kevinsmia1939 commented 1 year ago

The tick box to fixed the value during fitting does not fixed the value. The value change when fitting was done. I use the latest commit: 0e11a6d3be387c488b5c738bee5af6c9e8a2938b

Screenshot_20230929_185551 Screenshot_20230929_185629

Julian-Hochhaus commented 1 year ago

I have a idea on how to fix, but can't try out until in like ~10 days when I am back from my trip.

Try substituting in main.py, l2566:

pars[strind + str(index_pk + 1) + '_gamma'].vary = True with:

if not self.pre[2][3][2 * index_pk] == 2: pars[strind + str(index_pk + 1) + '_gamma'].vary = True

The reason is probably: By default the gamma (lorentzian sigma) is fixed to the sigma (gaussian sigma) parameter in Voigt model as implemented by lmfit. Therefore I unset it by default when setting up ratios between different peak models. However, the ratio setup is probably called after the check for which checkbox is checked.

If that does not solve it, I need to dig deeper and probably won't find it without running and testing the code :) So good luck, maybe it's the way to success!

kevinsmia1939 commented 1 year ago

if not self.pre[2][3][2 * index_pk] == 2: pars[strind + str(index_pk + 1) + '_gamma'].vary = True

Work like a charm!

Julian-Hochhaus commented 1 year ago

That’s great! Feel free to open pull request!