1616
1717# local modules
1818try :
19- from Spectra_fit_funcs import Spectra_Fit , Single_Gaussian
19+ from Spectra_fit_funcs import Spectra_Fit , Single_Gaussian , Single_Lorentzian
2020except :
21- from Spectrum_analysis .Spectra_fit_funcs import Spectra_Fit , Single_Gaussian
21+ from Spectrum_analysis .Spectra_fit_funcs import Spectra_Fit , Single_Gaussian , Single_Lorentzian
2222
2323
2424"""Recylce params for plotting"""
@@ -48,7 +48,7 @@ def __init__(self):
4848 self .ui = WindowTemplate ()
4949 self .ui .setupUi (self )
5050
51- self .ui .fitFunc_comboBox .addItems (["Single Gaussian" ,"Double Gaussian" , "Multiple Gaussians" ])
51+ self .ui .fitFunc_comboBox .addItems (["Single Gaussian" ,"Single Lorentzian" , " Double Gaussian" , "Multiple Gaussians" ])
5252
5353# self.ui.actionSave.triggered.connect(self.save_file)
5454# self.ui.actionExit.triggered.connect(self.close_application)
@@ -119,7 +119,7 @@ def plot(self):
119119
120120 self .ui .plot .plot (self .x , self .y , clear = False , pen = 'r' )
121121 self .ui .plot .setLabel ('left' , 'Intensity' , units = 'a.u.' )
122- self .ui .plot .setLabel ('bottom' , 'Wavelength' , units = 'nm ' )
122+ self .ui .plot .setLabel ('bottom' , 'Wavelength (nm) ' )
123123
124124
125125 def normalize (self ):
@@ -144,6 +144,14 @@ def fit_and_plot(self):
144144 self .ui .plot .plot (self .x , self .result .best_fit , clear = False , pen = 'k' )
145145 self .ui .result_textBrowser .setText (self .result .fit_report ())
146146
147+ elif fit_func == "Single Lorentzian" and self .ui .subtract_bck_checkBox .isChecked () == True :
148+
149+ single_lorentzian = Single_Lorentzian (self .file , self .bck_file )
150+ self .result = single_lorentzian .lorentzian_model ()
151+ self .ui .plot .plot (self .x , self .y , clear = True , pen = 'r' )
152+ self .ui .plot .plot (self .x , self .result .best_fit , clear = False , pen = 'k' )
153+ self .ui .result_textBrowser .setText (self .result .fit_report ())
154+
147155 elif fit_func == "Double Gaussian" and self .ui .subtract_bck_checkBox .isChecked () == True :
148156 self .ui .result_textBrowser .setText ("Not Implemented Yet!" )
149157
0 commit comments