本文整理汇总了Python中sas.models.BaseComponent.BaseComponent.setParam方法的典型用法代码示例。如果您正苦于以下问题:Python BaseComponent.setParam方法的具体用法?Python BaseComponent.setParam怎么用?Python BaseComponent.setParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sas.models.BaseComponent.BaseComponent
的用法示例。
在下文中一共展示了BaseComponent.setParam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setParam
# 需要导入模块: from sas.models.BaseComponent import BaseComponent [as 别名]
# 或者: from sas.models.BaseComponent.BaseComponent import setParam [as 别名]
def setParam(self, name, value):
"""
Set a parameter value
:param name: parameter name
"""
if name.lower() in self.params:
BaseComponent.setParam(self, name, value)
else:
self.model.setParam(name, value)
示例2: setParam
# 需要导入模块: from sas.models.BaseComponent import BaseComponent [as 别名]
# 或者: from sas.models.BaseComponent.BaseComponent import setParam [as 别名]
def setParam(self, name, value):
"""
Function to set the value of a parameter.
Both VolumeCanvas parameters and shape parameters
are accessible.
Note: if shape parameters are accessed directly
from outside VolumeCanvas. The getPr method
should be called before evaluating I(q).
TODO: implemented a check method to protect
against that.
@param name: name of the parameter to change
@param value: value to give the parameter
"""
# Lowercase for case insensitivity
name = name.lower()
# Look for shape access
toks = name.split('.')
# If a shape identifier was given, look the shape up
# in the dictionary
if len(toks)>1:
if toks[0] in self.shapes.keys():
# The shape was found, now look for the parameter
if toks[1] in self.shapes[toks[0]].params:
# The parameter was found, now change it
self.shapes[toks[0]].params[toks[1]] = value
self._model_changed()
else:
raise ValueError, "Could not find parameter %s" % name
else:
raise ValueError, "Could not find shape %s" % toks[0]
else:
# If we are not accessing the parameters of a
# shape, see if the parameter is part of this object
BaseComponent.setParam(self, name, value)
self._model_changed()