本文整理汇总了Python中mantid.api.FunctionFactory.createCompositeFunction方法的典型用法代码示例。如果您正苦于以下问题:Python FunctionFactory.createCompositeFunction方法的具体用法?Python FunctionFactory.createCompositeFunction怎么用?Python FunctionFactory.createCompositeFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mantid.api.FunctionFactory
的用法示例。
在下文中一共展示了FunctionFactory.createCompositeFunction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initByName
# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createCompositeFunction [as 别名]
def initByName(self, name, *args, **kwargs):
"""
intialise composite function of named type.
E.g. "ProductFunction"
This function would be protected in c++
and should not be called directly except
by :meth:`__init__` functions of this class
and subclasses.
:param name: name of class calling this.
:param args: names of functions in composite function
:param kwargs: any parameters or attributes that must be passed to the
composite function itself.
"""
if len(args) == 1 and not isinstance(args[0], FunctionWrapper):
# We have a composite function to wrap
self.fun = args[0]
else:
self.fun = FunctionFactory.createCompositeFunction(name)
# Add the functions, checking for Composite & Product functions
for a in args:
if not isinstance(a, int):
if isinstance(a, CompositeFunctionWrapper):
if self.pureAddition:
self.pureAddition = a.pureAddition
if self.pureMultiplication:
self.pureMultiplication = a.pureMultiplication
functionToAdd = FunctionFactory.createInitialized(a.fun.__str__())
self.fun.add(functionToAdd)
self.init_paramgeters_and_attributes(**kwargs)