当前位置: 首页>>代码示例>>Python>>正文


Python FunctionFactory.createCompositeFunction方法代码示例

本文整理汇总了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)
开发者ID:mantidproject,项目名称:mantid,代码行数:33,代码来源:fitfunctions.py


注:本文中的mantid.api.FunctionFactory.createCompositeFunction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。