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


Python PSet._quiet_set方法代码示例

本文整理汇总了Python中icf.core.PSet._quiet_set方法的典型用法代码示例。如果您正苦于以下问题:Python PSet._quiet_set方法的具体用法?Python PSet._quiet_set怎么用?Python PSet._quiet_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在icf.core.PSet的用法示例。


在下文中一共展示了PSet._quiet_set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sample

# 需要导入模块: from icf.core import PSet [as 别名]
# 或者: from icf.core.PSet import _quiet_set [as 别名]
def sample(name,
           version=None,
           n_events = -1,
           format = ("ICF", 2),
           path="/vols/cms02/as1604/PhysicsUtils/SampleDB2/store",
	   node = "IC_DCACHE"
	):
    store = openStore(path)
    if not store.Exists(name+"/_sample_.json"):
        print "Sample '%s' not found" % name
        sys.exit(1)
    samp = store.Get(name+"/_sample_.json")
    vers = None
    if version is not None:
        if not store.Exists("%s/%s.json" % (name, version)):
            print "No version '%s' for sample '%s'" % (version,name)
            sys.exit(1)
        vers = store.Get("%s/%s.json" % (name, version))
    else:
        if not store.Exists("%s/%s.json" % (name, samp.latest)):
            print "Oops the sample specified latest version '%s' cannot be found" % samp.latest
        vers = store.Get("%s/%s.json" % (name, sampl.latest))
    ps = PSet(Format = format)
    if samp.cross_section == -1:
        ps._quiet_set("Weight", 1.0)
    else:
        ps._quiet_set("CrossSection", samp.cross_section)
    total_events = 0
    files = []
    for b in vers.blocks:
	if b["node"] != node:
	    continue
        try:
            for f in b["files"]:
                if f["events"] == -1:
                    continue
                files.append(str(se_path_to_url(f["path"], "dcap")))
                total_events += f["events"]
                if n_events != -1 and total_events >= n_events:
                    raise BreakMeOut
        except BreakMeOut:
            break
    ps._quiet_set("File", files)
    name = samp.name[1:].replace("/", "_")
    if version is not None:
	name += "_"+vers.name
    ps._quiet_set("Name", str(name))
    ps._quiet_set("Events", total_events)
    return ps
开发者ID:alexsparrow,项目名称:PhysicsUtils,代码行数:51,代码来源:api.py

示例2: evList_to_pset

# 需要导入模块: from icf.core import PSet [as 别名]
# 或者: from icf.core.PSet import _quiet_set [as 别名]
def evList_to_pset(fname, debug=False):
    """ Takes an input event list file and converts to a PSet suitable for use in analysis code."""
    """NOTE: made for txt file format 'Run:LS:Event' """

    import sys
    from icf.core import PSet

    with open(fname, "r") as f:

        p = PSet()

        runList = []
        lumiSList = []
        evList = []

        for line in f:
            lineTmp = line.split(":")

            #fill each list
            runList.append(int(lineTmp[0]))
            lumiSList.append(int(lineTmp[1]))
            evList.append(int(lineTmp[2]))

        #create new entry in the PSet for each list
        p._quiet_set("Run", runList)
        p._quiet_set("Lumi", lumiSList)
        p._quiet_set("Event", evList)

        return p.ps()
开发者ID:lucasc896,项目名称:charmStudy,代码行数:31,代码来源:utils.py

示例3: pset

# 需要导入模块: from icf.core import PSet [as 别名]
# 或者: from icf.core.PSet import _quiet_set [as 别名]
    def pset(**opts):
        from icf.core import PSet
        if not "nt_format" in opts:
            raise ValueError("Must supply nt_format argument")
        nt_format = opts["nt_format"]
        if "pset_name" in opts:
            pset_name = opts["pset_name"]
            del opts["pset_name"]
        else:
            pset_name = None
        info = self.sample(**opts)

        ps = PSet()
        if pset_name is not None:
            ps._quiet_set("Name", pset_name)
        else:
            if "name" in opts:
                ps._quiet_set("Name", opts["name"].replace("/", "_").replace("*",""))
            elif "dbs" in opts:
                ps._quiet_set("Name", opts["name"].replace("/", "_"))
            else:
                raise ValueError("Cannot construct name")
        ps._quiet_set("Format", nt_format)
        ps._quiet_set("File", info["files"])
        if info["cross_section"] == -1:
            ps._quiet_set("Weight", 1.)
        else:
            ps._quiet_set("CrossSection", info["cross_section"])
        return ps
开发者ID:alexsparrow,项目名称:PhysicsUtils,代码行数:31,代码来源:api.py


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