@@ -55,6 +55,15 @@ def gaussian_model(self):
5555 pars = gmodel .guess (y , x = x ) # parameters - center, width, height
5656 result = gmodel .fit (y , pars , x = x , nan_policy = 'propagate' )
5757 return result
58+
59+ def gaussian_model_w_lims (self , center_min = None , center_max = None ):
60+ x ,y = self .background_correction ()
61+ gmodel = GaussianModel (prefix = 'g1_' ) # calling gaussian model
62+ pars = gmodel .guess (y , x = x ) # parameters - center, width, height
63+ # pars['g1_center'].set(800, min = 795, max = 820)
64+ gmodel .set_param_hint ('g1_center' , min = center_min , max = center_max )
65+ result = gmodel .fit (y , pars , x = x , nan_policy = 'propagate' )
66+ return result
5867
5968class Single_Lorentzian (Spectra_Fit ):
6069 """Fit a single Lorentzian to the spectrum
@@ -70,6 +79,14 @@ def lorentzian_model(self):
7079 pars = lmodel .guess (y , x = x ) # parameters - center, width, height
7180 result = lmodel .fit (y , pars , x = x , nan_policy = 'propagate' )
7281 return result
82+
83+ def lorentzian_model_w_lims (self , center_min = None , center_max = None ):
84+ x ,y = self .background_correction ()
85+ lmodel = LorentzianModel (prefix = 'l1_' ) # calling lorentzian model
86+ pars = lmodel .guess (y , x = x ) # parameters - center, width, height
87+ lmodel .set_param_hint ('l1_center' , min = center_min , max = center_max )
88+ result = lmodel .fit (y , pars , x = x , nan_policy = 'propagate' )
89+ return result
7390
7491class Double_Gaussian (Spectra_Fit ):
7592 """Fit two gaussians to the spectrum
0 commit comments