【问题标题】:Gaussian fit not taking into account negative part of the peak高斯拟合不考虑峰值的负部分
【发布时间】:2021-08-20 13:13:36
【问题描述】:

正如你们在下图中看到的,我正在对频谱进行高斯拟合,其中一些频谱位于 y 轴的负值部分:

这就是我的健身方式:

def Gauss(velo_peak, a, mu0, sigma):
         res = a * np.exp(-(velo_peak - mu0)**2 / (2 * sigma**2))
         return res
mu0 = sum(velo_peak * spec_peak) / sum(spec_peak)
sigma = np.sqrt(sum(spec_peak * (velo_peak - mu0)**2) / sum(spec_peak))
peak = max(spec_peak) 
p0 = [peak, mu0, sigma]   
popt,pcov = curve_fit(Gauss, velo_peak, spec_peak, p0, maxfev=100000)

我的主要目标是找到光谱的峰值,但这显然是对峰值的高估。是否有一些条件可以应用于高斯拟合函数?

【问题讨论】:

    标签: python curve-fitting gaussian spectrum


    【解决方案1】:

    由于您可以定义任何您想要的函数,请尝试为您的Gauss 函数添加偏移量:

    def Gauss(velo_peak, a, mu0, sigma, offs):
             res = a * np.exp(-(velo_peak - mu0)**2 / (2 * sigma**2)) + offs
             return res
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-12
      • 2021-06-22
      • 2017-02-23
      • 2022-01-02
      • 2020-11-30
      • 2018-05-26
      • 2020-07-15
      相关资源
      最近更新 更多