峰值拟合lmfit nan结果

时间:2016-05-20 15:00:31

标签: python-2.7 lmfit

尝试为某些数据设置峰值:

import scipy
from lmfit.models import GaussianModel
x = shm.PTR_P
y = shm.PORE_V_P
mod = LorentzianModel()

pars = mod.guess(y, x=x)
out  = mod.fit(y, pars, x=x)
print(out.fit_report(min_correl=0.25))

虽然如果我生成数据我可以做到合适,但如果我尝试从其他来源读取它们它就不起作用。我不太擅长这个,也不知道问题是什么。这是输出:

  

[X,Y]   [(34.145490000000002,3.4599999999999999e-08),    (29.286449999999999,4.8399999999999997e-08),    (25.118860000000002,0.026773140000000001),    (21.544350000000001,0.068791409999999997),    (18.4785,0.083200979999999994),    (15.848929999999999,0.02123179),    (11.659139999999999,0.01551077),    (10.0,0.084493879999999993),    (6.3095739999999996,20.899999999999998e-07),    (5.4116949999999999,0.045209140000000002),    (4.6415889999999997,0.054789360000000002),    (3.4145489999999996,8.9399999999999993e-08),    (2.9286449999999999,0.01100814),    (2.5118860000000001,0.088990659999999999),    (1.84785,3.5799999999999995e-07),    (1.5848930000000001,0.099999009999999999),    (1.359356,0.075139280000000003),    (1.1659139999999999,0.167379),    (1.0,0.57693050000000001),    (0.85769590000000007,1.8658159999999999),    (0.73564230000000008,8.4961369999999992),    (0.6309574,25.299099999999999),    (0.54116949999999997,21.413350000000001),    (0.46415889999999999,13.408829999999998),    (0.39810719999999999,8.3584750000000003),    (0.34145490000000006,5.3982010000000002),    (0.29286440000000002,3.7518540000000002),    (0.25118859999999998,2.5325389999999999),    (0.21544349999999998,1.7722470000000001),    (0.18478499999999998,1.445808),    (0.15848929999999997,1.182083),    (0.13593559999999999,0.94957730000000007),    (0.1165914,0.66720849999999999),    (0.10000000000000001,0.46631620000000001),    (0.085769590000000007,0.41001890000000002),    (0.07356422,0.30625920000000001),    (0.063095730000000003,0.24040219999999998),    (0.054116949999999997,0.1942596),    (0.046415890000000001,0.11306760000000002),    (0.039810720000000001,0.099998470000000006),    (0.034145490000000001,0.099998470000000006),    (0.029286449999999999,0.02246857),    (0.025118870000000001,0.077529909999999994)]

1 个答案:

答案 0 :(得分:0)

我猜你的数据中有NaN或者最初的猜测是产生NaNs。 UPDATE DataImport SET FirstName = initcap(FirstName); UPDATE DataImport SET LastName = initcap(LastName); 的初始猜测0似乎是可疑的 - 这应该是> 0。 无论哪种方式,绘制数据并使用sigma可能有助于隔离问题。