如何禁止打印"添加参数"在以下代码中
In [7]: from numpy import sqrt, pi, exp, linspace
In [8]: import numpy as np
In [9]: def gaussian(x, amp, cen, wid):
...: return amp * exp(-(x-cen)**2 /wid)
...: x = linspace(-10,10)
...: y = gaussian(x, 2.33, 0.21, 1.51) + np.random.normal(0, 0.2, len(x))
...:
In [10]: from lmfit import Model
In [11]: gmod = Model(gaussian)
In [12]: result = gmod.fit(y, x=x, amp=5, cen=5, wid=1)#<-- here!!
- Adding parameter "amp"
- Adding parameter "cen"
- Adding parameter "wid"
感谢。
答案 0 :(得分:0)
为了抑制此输出,需要添加verbose = False
fit(..., verbose=False)