本文整理汇总了Python中channel.Channel.setWeights方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.setWeights方法的具体用法?Python Channel.setWeights怎么用?Python Channel.setWeights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类channel.Channel
的用法示例。
在下文中一共展示了Channel.setWeights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addChannel
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import setWeights [as 别名]
def addChannel(self, variableName, regions, nBins, binLow, binHigh):
"""
Build a channel object from this fitConfig
@param variableName The variable name to use in this channel
@param regions Region to use
@param nBins Number of bins
@param binLow Left edge of lower bin
@param binHight Right edge of upper bin
"""
if variableName == "cuts":
nBins = len(regions)
#binLow = 0.5
binHigh = nBins + binLow
pass
chanObj = Channel(variableName, regions, self.prefix, nBins,
binLow, binHigh, self.statErrThreshold)
# Verify that this name is not already used
for chan in self.channels:
if chan.name == chanObj.name:
log.info("Not gonna add the region, because it exists in fitConfig --> channel-List follows:" )
for chan in self.channels:
print " chan.name = ", chan.name
raise RuntimeError("Channel %s already exists in fitConfig %s. Please use a different name." % (chanObj.name, self.name))
#set channel parent
chanObj.parentTopLvl = self
#set stat error type
chanObj.statErrorType = self.statErrorType
# Channel doesn't have weights so add them
chanObj.setWeights(self.weights)
# Propagate systematics into channel
for (systName, syst) in self.systDict.items():
chanObj.addSystematic(syst)
# Put samples owned by this fitConfig into the channel
for s in self.sampleList:
chanObj.addSample(s.Clone())
# Add channel to the list
self.channels.append(chanObj)
return self.channels[len(self.channels) - 1]