@@ -179,7 +179,10 @@ def acquire_settings(self, mode="data"):# mode --looks whether argument is data
179179 def plot (self ):
180180 try :
181181 x ,y = self .acquire_settings ()
182- self .ui .plot .plot (x , y , clear = False , pen = pg .mkPen (self .plot_color ))
182+ if self .ui .normalize_checkBox .isChecked ():
183+ y = y / np .amax (y )
184+
185+ self .ui .plot .plot (x , y , clear = self .ui .clear_plot_checkBox .isChecked (), pen = pg .mkPen (self .plot_color ))
183186
184187 try :
185188 self .ui .Result_textBrowser .setText ("Integral Counts :\n " "{:.2E}" .format (
@@ -215,15 +218,15 @@ def fit_and_plot(self):
215218 TRPL_interp = np .interp (time_fit , t , y )
216219
217220 fit_func = self .ui .FittingFunc_comboBox .currentText ()
218- self .ui .plot .plot (t , y , clear = True , pen = pg .mkPen (self .plot_color ))
221+ self .ui .plot .plot (t , y , clear = self . ui . clear_plot_checkBox . isChecked () , pen = pg .mkPen (self .plot_color ))
219222
220223 if fit_func == "Stretched Exponential" : #stretch exponential tab
221224 tc , beta , a , avg_tau , PL_fit = stretch_exp_fit (TRPL_interp , t )
222225 self .out = np .empty ((len (t ), 3 ))
223226 self .out [:,0 ] = t #time
224227 self .out [:,1 ] = TRPL_interp #Raw PL
225228 self .out [:,2 ] = PL_fit # PL fit
226- self .ui .plot .plot (t , PL_fit , clear = False , pen = 'k' )
229+ self .ui .plot .plot (t , PL_fit , clear = self . ui . clear_plot_checkBox . isChecked () , pen = 'k' )
227230 self .ui .Result_textBrowser .setText ("Fit Results:\n \n Fit Function: Stretched Exponential"
228231 "\n Fit Method: " + "diff_ev" + #TODO : change when diff_ev and fmin_tnc implemented for non-irf
229232 "\n Average Lifetime = " + str (avg_tau )+ " ns"
@@ -236,7 +239,7 @@ def fit_and_plot(self):
236239 self .out [:,0 ] = t #time
237240 self .out [:,1 ] = TRPL_interp #Raw PL
238241 self .out [:,2 ] = PL_fit # PL fit
239- self .ui .plot .plot (t , PL_fit , clear = False , pen = 'k' )
242+ self .ui .plot .plot (t , PL_fit , clear = self . ui . clear_plot_checkBox . isChecked () , pen = 'k' )
240243 self .ui .Result_textBrowser .setText ("Fit Results:\n \n Fit Function: Double Exponential"
241244 "\n Fit Method: " + "diff_ev" +
242245 "\n Average Lifetime = " + str (avg_tau )+ " ns"
@@ -251,7 +254,7 @@ def fit_and_plot(self):
251254 self .out [:,0 ] = t #time
252255 self .out [:,1 ] = TRPL_interp #Raw PL
253256 self .out [:,2 ] = PL_fit # PL fit
254- self .ui .plot .plot (t , PL_fit , clear = False , pen = 'k' )
257+ self .ui .plot .plot (t , PL_fit , clear = self . ui . clear_plot_checkBox . isChecked () , pen = 'k' )
255258 self .ui .Result_textBrowser .setText ("Fit Results:\n \n Fit Function: Single Exponential"
256259 "\n Fit Method: " + "diff_ev" +
257260 "\n Lifetime = " + str (tau )+ " ns"
@@ -287,7 +290,7 @@ def fit_and_plot_with_irf(self):
287290 TRPL_interp = np .interp (time_fit , t , y )
288291
289292 fit_func = self .ui .FittingFunc_comboBox .currentText ()
290- self .ui .plot .plot (t , y , clear = True , pen = pg .mkPen (self .plot_color ))
293+ self .ui .plot .plot (t , y , clear = self . ui . clear_plot_checkBox . isChecked () , pen = pg .mkPen (self .plot_color ))
291294 if fit_func == "Stretched Exponential" : #stretched exponential tab
292295 tc_bounds = (self .ui .str_tc_min_spinBox .value (), self .ui .str_tc_max_spinBox .value ()) #(0, 10000)
293296 a_bounds = (self .ui .str_a_min_spinBox .value (), self .ui .str_a_max_spinBox .value ())#(0.9, 1.1)
@@ -306,7 +309,7 @@ def fit_and_plot_with_irf(self):
306309 self .out [:,0 ] = t #time
307310 self .out [:,1 ] = TRPL_interp #Raw PL
308311 self .out [:,2 ] = bestfit_model # PL fit
309- self .ui .plot .plot (t , bestfit_model , clear = False , pen = 'k' )
312+ self .ui .plot .plot (t , bestfit_model , clear = self . ui . clear_plot_checkBox . isChecked () , pen = 'k' )
310313 self .ui .Result_textBrowser .setText ("Fit Results:\n \n Fit Function: Stretched Exponential"
311314 "\n Fit Method: " + self .ui .FittingMethod_comboBox .currentText () +
312315 "\n tau_avg = %.5f ns"
@@ -335,7 +338,7 @@ def fit_and_plot_with_irf(self):
335338 self .out [:,0 ] = t #time
336339 self .out [:,1 ] = TRPL_interp #Raw PL
337340 self .out [:,2 ] = bestfit_model # PL fit
338- self .ui .plot .plot (t , bestfit_model , clear = False , pen = 'k' )
341+ self .ui .plot .plot (t , bestfit_model , clear = self . ui . clear_plot_checkBox . isChecked () , pen = 'k' )
339342 self .ui .Result_textBrowser .setText ("Fit Results:\n \n Fit Function: Double Exponential"
340343 "\n Fit Method: " + self .ui .FittingMethod_comboBox .currentText () +
341344 "\n a1 = %.5f"
@@ -359,7 +362,7 @@ def fit_and_plot_with_irf(self):
359362 self .out [:,0 ] = t #time
360363 self .out [:,1 ] = TRPL_interp #Raw PL
361364 self .out [:,2 ] = bestfit_model # PL fit
362- self .ui .plot .plot (t , bestfit_model , clear = False , pen = 'k' )
365+ self .ui .plot .plot (t , bestfit_model , clear = self . ui . clear_plot_checkBox . isChecked () , pen = 'k' )
363366 self .ui .Result_textBrowser .setText ("Fit Results:\n \n Fit Function: Single Exponential"
364367 "\n Fit Method: " + self .ui .FittingMethod_comboBox .currentText () +
365368 "\n a = %.5f"
0 commit comments