我想做一个多重高斯拟合。这里有两个问题
我的代码是:
from astropy.modeling.models import Gaussian1D
from astropy.modeling import fitting
np.random.seed(0)
x = x_k
y = y_k
y += np.random.normal(0., 0.2, x.shape)
g1 = Gaussian1D(amplitude=8, mean=-3000, stddev=2000)
g1.bounding_box.amplitude = (5, 10) #I am not sure this format is right because I cannot find an example in astropy
g1.bounding_box.mean = (-4000,-1000)
g2 = Gaussian1D(amplitude=10, mean=0, stddev=2500)
g2.bounding_box.amplitude = (5, 10)
g3 = Gaussian1D(amplitude=8, mean=3000, stddev=2000)
g3.bounding_box.amplitude = (5, 10)
fit_g = fitting.LevMarLSQFitter()
g = fit_g(g1+g2+g3, x, y)
结果是:
^{pr2}$很明显这不管用。怎么了?在
目前没有回答
相关问题 更多 >
编程相关推荐