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


Python FunctionFactory.getFunctionNames方法代码示例

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


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

示例1: test_function_existing_function_can_be_unsubscribed

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import getFunctionNames [as 别名]
 def test_function_existing_function_can_be_unsubscribed(self):
     FunctionFactory.subscribe(TestFunctionCorrectForm)
     nfuncs_before = len(FunctionFactory.getFunctionNames())
     FunctionFactory.unsubscribe("TestFunctionCorrectForm")
     available_functions = FunctionFactory.getFunctionNames()
     self.assertEquals(nfuncs_before - 1, len(available_functions))
     self.assertTrue("TestFunctionCorrectForm" not in available_functions)
开发者ID:mantidproject,项目名称:mantid,代码行数:9,代码来源:FunctionFactoryTest.py

示例2: test_function_subscription

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import getFunctionNames [as 别名]
 def test_function_subscription(self):
     nfuncs_orig = len(FunctionFactory.getFunctionNames())
     FunctionFactory.subscribe(TestFunction)
     new_funcs = FunctionFactory.getFunctionNames()
     self.assertEquals(nfuncs_orig+1, len(new_funcs))
     self.assertTrue("TestFunction" in new_funcs)
     
     FunctionFactory.unsubscribe("TestFunction")
     new_funcs = FunctionFactory.getFunctionNames()
     self.assertEquals(nfuncs_orig, len(new_funcs))
     self.assertTrue("TestFunction" not in new_funcs)
开发者ID:AlistairMills,项目名称:mantid,代码行数:13,代码来源:FunctionFactoryTest.py

示例3: skip

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import getFunctionNames [as 别名]
    def skip(self):
        """
        Override and return a string depending on whether the directive
        should be skipped. If empty then the directive should be processed
        otherwise the string should contain the error message
        The default is to skip (and warn) if the algorithm is not known.

        Returns:
          str: Return error mesage string if the directive should be skipped
        """
        from mantid.api import AlgorithmFactory, FunctionFactory

        name, version = self.algorithm_name(), self.algorithm_version()
        msg = ""
        if version is None: # it is a fit function
            if name in FunctionFactory.getFunctionNames():
                return ""
            else:
                msg = "No fit function '%s', skipping directive" % name
        else:
            if AlgorithmFactory.exists(name, version):
                return ""
            else:
                msg = "No algorithm '%s' version '%d', skipping directive" % (name, version)

        # warn the user
        if len(msg) > 0:
            env = self.state.document.settings.env
            env.app.verbose(msg)
        return msg
开发者ID:liyulun,项目名称:mantid,代码行数:32,代码来源:base.py

示例4: test_get_functions

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import getFunctionNames [as 别名]
 def test_get_functions(self):
     all_funcs = FunctionFactory.getFunctionNames()
     self.assertTrue( len(all_funcs) > 0 )
     self.assertTrue("Gaussian" in all_funcs)
开发者ID:AlistairMills,项目名称:mantid,代码行数:6,代码来源:FunctionFactoryTest.py

示例5: _wrappers

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import getFunctionNames [as 别名]
def _wrappers():
    wrappers = []
    for name in FunctionFactory.getFunctionNames():
        # Wrap all registered functions which are not in the black list
        if name not in _do_not_wrap:
            yield name, _create_wrapper_function(name)
开发者ID:mantidproject,项目名称:mantid,代码行数:8,代码来源:fitfunctions.py

示例6: test_function_with_expected_attrs_subscribes_successfully

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import getFunctionNames [as 别名]
 def test_function_with_expected_attrs_subscribes_successfully(self):
     nfuncs_orig = len(FunctionFactory.getFunctionNames())
     FunctionFactory.subscribe(TestFunctionCorrectForm)
     new_funcs = FunctionFactory.getFunctionNames()
     self.assertEquals(nfuncs_orig+1, len(new_funcs))
     self.assertTrue("TestFunctionCorrectForm" in new_funcs)
开发者ID:mantidproject,项目名称:mantid,代码行数:8,代码来源:FunctionFactoryTest.py

示例7: test_function_subscription_without_required_attrs_fails

# 需要导入模块: from mantid.api import FunctionFactory [as 别名]
# 或者: from mantid.api.FunctionFactory import getFunctionNames [as 别名]
 def test_function_subscription_without_required_attrs_fails(self):
     self.assertRaises(RuntimeError, FunctionFactory.Instance().subscribe, TestFunctionNoAttrs)
     self.assertTrue("TestFunctionNoAttrs" not in FunctionFactory.getFunctionNames())
     self.assertRaises(RuntimeError, FunctionFactory.Instance().subscribe, TestFunctionOnlyInit)
     self.assertTrue("TestFunctionOnlyInit" not in FunctionFactory.getFunctionNames())
开发者ID:mantidproject,项目名称:mantid,代码行数:7,代码来源:FunctionFactoryTest.py


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