本文整理汇总了Python中WMCore.DataStructs.LumiList.LumiList.selectRuns方法的典型用法代码示例。如果您正苦于以下问题:Python LumiList.selectRuns方法的具体用法?Python LumiList.selectRuns怎么用?Python LumiList.selectRuns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.DataStructs.LumiList.LumiList
的用法示例。
在下文中一共展示了LumiList.selectRuns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRemoveSelect
# 需要导入模块: from WMCore.DataStructs.LumiList import LumiList [as 别名]
# 或者: from WMCore.DataStructs.LumiList.LumiList import selectRuns [as 别名]
def testRemoveSelect(self):
"""
a-b for lots of cases
"""
alumis = {'1' : range(2,20) + range(31,39) + range(45,49),
'2' : range(6,20) + range (30,40),
'3' : range(10,20) + range (30,40) + range(50,60),
'4' : range(10,20) + range (30,80),
}
result = {'2' : range(6,20) + range (30,40),
'4' : range(10,20) + range (30,80),
}
rem = LumiList(runsAndLumis = alumis)
sel = LumiList(runsAndLumis = alumis)
res = LumiList(runsAndLumis = result)
rem.removeRuns([1,3])
sel.selectRuns([2,4])
self.assertTrue(rem.getCMSSWString() == res.getCMSSWString())
self.assertTrue(sel.getCMSSWString() == res.getCMSSWString())
self.assertTrue(sel.getCMSSWString() == rem.getCMSSWString())
示例2: validFiles
# 需要导入模块: from WMCore.DataStructs.LumiList import LumiList [as 别名]
# 或者: from WMCore.DataStructs.LumiList.LumiList import selectRuns [as 别名]
def validFiles(self, files):
"""
Apply lumi mask and or run white/black list and return files which have
one or more of the requested lumis
"""
runWhiteList = self.topLevelTask.inputRunWhitelist()
runBlackList = self.topLevelTask.inputRunBlacklist()
taskLumiMask = self.topLevelTask.getLumiMask()
blackMask = None
if taskLumiMask: # We have a lumiMask, so use it and modify with run white/black list
if isinstance(taskLumiMask, LumiList): # For a possible future where we use LumiList more prevalently
lumiMask = copy.deepcopy(taskLumiMask)
else:
lumiMask = LumiList(compactList=taskLumiMask)
if runWhiteList:
lumiMask.selectRuns(runWhiteList)
if runBlackList:
lumiMask.removeRuns(runBlackList)
elif runWhiteList: # We have a run whitelist, subtract off blacklist
lumiMask = LumiList(runs=runWhiteList)
if runBlackList: # We only have a blacklist, so make a black mask out of it instead
lumiMask.removeRuns(runBlackList)
else:
lumiMask = None
if runBlackList:
blackMask = LumiList(runs=runBlackList)
results = []
for f in files:
if isinstance(f, basestring) or "LumiList" not in f:
results.append(f)
continue
# Create a LumiList from the WMBS info
runLumis = {}
for x in f['LumiList']:
if x['RunNumber'] in runLumis:
runLumis[x['RunNumber']].extend(x['LumiSectionNumber'])
else:
runLumis[x['RunNumber']] = x['LumiSectionNumber']
fileLumiList = LumiList(runsAndLumis=runLumis)
if lumiMask:
if fileLumiList & lumiMask: # At least one lumi from file is in lumiMask
results.append(f)
elif blackMask:
if fileLumiList - blackMask: # At least one lumi from file is not in blackMask
results.append(f)
else: # There is effectively no mask
results.append(f)
return results