本文整理汇总了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)
示例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)
示例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
示例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)
示例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)
示例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)
示例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())