本文整理汇总了Python中lmfit.models.GaussianModel.eval方法的典型用法代码示例。如果您正苦于以下问题:Python GaussianModel.eval方法的具体用法?Python GaussianModel.eval怎么用?Python GaussianModel.eval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lmfit.models.GaussianModel
的用法示例。
在下文中一共展示了GaussianModel.eval方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: measure_line_index_recover_spectrum
# 需要导入模块: from lmfit.models import GaussianModel [as 别名]
# 或者: from lmfit.models.GaussianModel import eval [as 别名]
def measure_line_index_recover_spectrum(wave, params, norm=False):
""" recover the fitted line profile from params
Parameters
----------
wave: array-like
the wavelength to which the recovered flux correspond
params: 5-element tuple
the 1 to 5 elements are:
mod_linear_slope
mod_linear_intercept
mod_gauss_amplitude
mod_gauss_center
mod_gauss_sigma
norm: bool
if True, linear model (continuum) is deprecated
else linear + Gaussian model is used
"""
from lmfit.models import LinearModel, GaussianModel
mod_linear = LinearModel(prefix='mod_linear_')
mod_gauss = GaussianModel(prefix='mod_gauss_')
par_linear = mod_linear.make_params()
par_gauss = mod_gauss.make_params()
par_linear['mod_linear_slope'].value = params[0]
par_linear['mod_linear_intercept'].value = params[1]
par_gauss['mod_gauss_amplitude'].value = params[2]
par_gauss['mod_gauss_center'].value = params[3]
par_gauss['mod_gauss_sigma'].value = params[4]
if not norm:
flux = 1 - mod_gauss.eval(params=par_gauss, x=wave)
else:
flux = \
(1 - mod_gauss.eval(params=par_gauss, x=wave)) * \
mod_linear.eval(params=par_linear, x=wave)
return flux