我正在尝试使用扩展的 Chebyshev pdf 进行拟合。为此,我使用预定义zfit.pdf.Chebyshev()
的 . 我在这里想念什么?
import tensorflow as tf
import zfit
from zfit import ztf
obs = zfit.Space('mass', limits=(-1000., 1000.))
slope = zfit.Parameter("slope", -0.1, -1., 1., floating = True)
Nbkg = zfit.Parameter("Nbkg", 10, 0., 1000)
bkg_pdf = Nbkg*zfit.pdf.Chebyshev(obs =obs, coeffs = [slope])
对于所有预定义的多项式(Chebyshev/Legendre/Hermite),我收到以下错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-a86d6be1cc9d> in <module>
2 slope = zfit.Parameter("slope", -0.1, -1., 1., floating = True)
3 Nbkg = zfit.Parameter("Nbkg", 10, 0., 1000)
----> 4 bkg_pdf = Nbkg*zfit.pdf.Chebyshev(obs =obs, coeffs = [slope])
5
6
~/soft/minconda3/envs/my-analysis-env/lib/python3.7/site-packages/zfit/core/parameter.py in __mul__(self, other)
289 from . import operations
290 with suppress(NotImplementedError):
--> 291 return operations.multiply(self, other)
292 return super().__mul__(other)
293
~/soft/minconda3/envs/my-analysis-env/lib/python3.7/site-packages/zfit/core/operations.py in multiply(object1, object2)
34 new_object = multiply_param_func(param=object1, func=object2)
35 elif isinstance(object2, ZfitPDF):
---> 36 new_object = multiply_param_pdf(param=object1, pdf=object2)
37 else:
38 assert False, "This code should never be reached due to logical reasons. Mistakes happen..."
~/soft/minconda3/envs/my-analysis-env/lib/python3.7/site-packages/zfit/core/operations.py in multiply_param_pdf(param, pdf)
86 if pdf.is_extended:
87 raise AlreadyExtendedPDFError()
---> 88 new_pdf = pdf.create_extended(param, name_addition="_autoextended")
89 return new_pdf
90
~/soft/minconda3/envs/my-analysis-env/lib/python3.7/site-packages/zfit/core/basepdf.py in create_extended(self, yield_, name_addition)
462 if self.is_extended:
463 raise AlreadyExtendedPDFError("This PDF is already extended, cannot create an extended one.")
--> 464 new_pdf = self.copy(name=self.name + str(name_addition))
465 new_pdf._set_yield_inplace(value=yield_)
466 return new_pdf
~/soft/minconda3/envs/my-analysis-env/lib/python3.7/site-packages/zfit/core/basepdf.py in copy(self, **override_parameters)
579 # parameters.update(distribution=self.distribution)
580 yield_ = parameters.pop('yield', None)
--> 581 new_instance = type(self)(**parameters)
582 if yield_ is not None:
583 new_instance._set_yield_inplace(yield_)
TypeError: __init__() got an unexpected keyword argument 'c_0'
我也尝试过zfit.pdf.Chebyshev().create_extended(Nbkg)
,为 pdf 设置规范化和coeff0
参数。