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
18 stars 7 forks source link

UnboundLocalError: local variable 'mod' referenced before assignment #52

Closed kevinsmia1939 closed 1 year ago

kevinsmia1939 commented 1 year ago

I encounter crash when I press evaluate after press fitting. I am using the latest git commit.

Python 3.10.10

Traceback (most recent call last):
  File "/home/kevin/Desktop/software/LG4X-V2/Python/main.py", line 1844, in eva
    self.ana('eva')
  File "/home/kevin/Desktop/software/LG4X-V2/Python/main.py", line 2890, in ana
    temp_res = self.BGModCreator(x, y, mode=mode)
  File "/home/kevin/Desktop/software/LG4X-V2/Python/main.py", line 2810, in BGModCreator
    temp_res = self.bgSelector(x, y, mode=mode, idx_bg= self.idx_bg[0])
  File "/home/kevin/Desktop/software/LG4X-V2/Python/main.py", line 2126, in bgSelector
    return [mod, bg_mod, pars]
UnboundLocalError: local variable 'mod' referenced before assignment
Aborted (core dumped)

I think that in the function bgSelector in main.py,

        if idx_bg == 100:
            if mode == "eva":
                shA = self.pre[1][0][1]
                shB = self.pre[1][0][3]
                pars = None
                bg_mod = xpy.shirley_calculate(x, y, shA, shB)

The mod is not define, so this cause an error.

Julian-Hochhaus commented 1 year ago

Problem is hopefully solved with last commits on dev branch :) thanks for catching that error!

kevinsmia1939 commented 1 year ago

Thanks, that fix the issue.