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


Python Channel.setWeights方法代码示例

本文整理汇总了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]
开发者ID:lawrenceleejr,项目名称:ZeroLeptonAnalysis,代码行数:49,代码来源:fitConfig.py


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