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


Python FunctionFactory.createFunction方法代码示例

本文整理汇总了Python中mantid.api.FunctionFactory.createFunction方法的典型用法代码示例。如果您正苦于以下问题:Python FunctionFactory.createFunction方法的具体用法?Python FunctionFactory.createFunction怎么用?Python FunctionFactory.createFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mantid.api.FunctionFactory的用法示例。


在下文中一共展示了FunctionFactory.createFunction方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: isregistered

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
def isregistered(function):
    status, msg = True, ""
    try:
        FunctionFactory.createFunction(function)
    except RuntimeError as exc:
        status, msg = False, 'Could not create {} function: {}'.format(function, str(exc))
    return status, msg
开发者ID:mantidproject,项目名称:mantid,代码行数:9,代码来源:StretchedExpFTTestHelper.py

示例2: is_registered

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
def is_registered(function_name):
    """
    Check whether the function with the specified name has been registered.

    :param function_name: The name of the function to check for registration.
    :return:              A tuple of the status (True if function is registered,
                          false otherwise) and the error message (empty if the
                          function is registered).
    """
    try:
        FunctionFactory.createFunction(function_name)
    except RuntimeError as exc:
        return False, 'Could not create {} function: {}'.format(function_name,
                                                                str(exc))
    return True, ""
开发者ID:DanNixon,项目名称:mantid,代码行数:17,代码来源:MsdTestHelper.py

示例3: create_mantid_ifunction

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
    def create_mantid_ifunction(self, function_name):
        """
        Create and initiializes a Mantid IFunction.

        Args:
          function_name (str): The name of the function to use.

        Returns:
          ifunction: An instance of a Mantid IFunction
        """
        from mantid.api import FunctionFactory
        return FunctionFactory.createFunction(function_name)
开发者ID:liyulun,项目名称:mantid,代码行数:14,代码来源:base.py

示例4: __init__

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
    def __init__(self, name, **kwargs):
        """
        Called when creating an instance

        :param name:   name of fitting function to create or
                       an Ifunction object to wrap.
        :param kwargs: standard argument for initializing fit
                       function
        """
        if not isinstance(name, str):
            self.fun = name
        else:
            self.fun = FunctionFactory.createFunction(name)
        self.init_paramgeters_and_attributes(**kwargs)
开发者ID:mantidproject,项目名称:mantid,代码行数:16,代码来源:fitfunctions.py

示例5: test_get_Gaussian

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
 def test_get_Gaussian(self):
     name = "Gaussian"
     func = FunctionFactory.createFunction(name)
     self.assertTrue(func.name() == name)
     self.assertTrue(len(func.__repr__()) > len(name))
     self.assertTrue("Peak" in func.categories())
开发者ID:AlistairMills,项目名称:mantid,代码行数:8,代码来源:FunctionFactoryTest.py

示例6: test_addition

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
 def test_addition(self):
     p = FunctionFactory.createFunction("ProductFunction")
     g = FunctionFactory.createFunction("Gaussian")
     p.add(g)
     p.add(g)
     self.assertEquals(len(p), 2)
开发者ID:samueljackson92,项目名称:mantid,代码行数:8,代码来源:ProductFunctionTest.py

示例7: test_length

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
 def test_length(self):
     p = FunctionFactory.createFunction("ProductFunction")
     self.assertEquals(len(p), 0)
开发者ID:samueljackson92,项目名称:mantid,代码行数:5,代码来源:ProductFunctionTest.py

示例8: test_type

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
 def test_type(self):
     p = FunctionFactory.createFunction("ProductFunction")
     self.assertTrue( isinstance(p,ProductFunction) )
     self.assertTrue( isinstance(p,CompositeFunction) )
开发者ID:samueljackson92,项目名称:mantid,代码行数:6,代码来源:ProductFunctionTest.py

示例9: test_category_override_returns_overridden_result

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
 def test_category_override_returns_overridden_result(self):
     FunctionFactory.subscribe(Times2)
     func = FunctionFactory.createFunction("Times2")
     self.assertEquals("SimpleFunction", func.category())
     FunctionFactory.unsubscribe("Times2")
开发者ID:rosswhitfield,项目名称:mantid,代码行数:7,代码来源:IFunction1DTest.py

示例10: test_category_with_no_override_returns_default_category

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
 def test_category_with_no_override_returns_default_category(self):
     FunctionFactory.subscribe(NoCatgeoryFunction)
     func = FunctionFactory.createFunction("NoCatgeoryFunction")
     self.assertEquals("General", func.category())
     FunctionFactory.unsubscribe("NoCatgeoryFunction")
开发者ID:rosswhitfield,项目名称:mantid,代码行数:7,代码来源:IFunction1DTest.py

示例11: test_instance_can_be_created_from_factory

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import createFunction [as 别名]
 def test_instance_can_be_created_from_factory(self):
     FunctionFactory.subscribe(Times2)
     func_name = Times2.__name__
     func = FunctionFactory.createFunction(func_name)
     self.assertTrue(isinstance(func, IFunction1D))
     FunctionFactory.unsubscribe(func_name)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:8,代码来源:IFunction1DTest.py


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