本文整理匯總了Python中parameter.Parameter.link方法的典型用法代碼示例。如果您正苦於以下問題:Python Parameter.link方法的具體用法?Python Parameter.link怎麽用?Python Parameter.link使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類parameter.Parameter
的用法示例。
在下文中一共展示了Parameter.link方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from parameter import Parameter [as 別名]
# 或者: from parameter.Parameter import link [as 別名]
def __init__(self, name, parts):
self.parts = tuple(parts)
allpars = []
for part in self.parts:
for p in part.pars:
if p in allpars:
# If we already have a reference to this parameter, store
# a hidden, linked proxy instead
pnew = Parameter(p.modelname, p.name, 0.0, hidden=True)
pnew.link = p
p = pnew
allpars.append(p)
Model.__init__(self, name, allpars)
示例2: __init__
# 需要導入模塊: from parameter import Parameter [as 別名]
# 或者: from parameter.Parameter import link [as 別名]
def __init__(self, name, parts):
self.parts = tuple(parts)
allpars = []
for part in self.parts:
for p in part.pars:
if p in allpars:
# If we already have a reference to this parameter, store
# a hidden, linked proxy instead
pnew = Parameter(p.modelname, p.name, 0.0, hidden=True)
pnew.link = p
p = pnew
allpars.append(p)
Model.__init__(self, name, allpars)
for part in self.parts:
try:
self.is_discrete = self.is_discrete or part.is_discrete
except:
warning("Could not determine whether the model is discrete.\n"+
"This probably means that you have restored a session saved with a previous version of Sherpa.\n"+
"Falling back to assuming that the model is continuous.\n")
self.is_discrete = False