opRefs = [ReferenceBenchmark.SP, ReferenceBenchmark.Pd, ReferenceBenchmark.Pf]
    refBenchmarkList = ReferenceBenchmarkCollection([])
    for ref in opRefs: 
      refBenchmarkList.append( ReferenceBenchmark( "OperationPoint_" + refLabel.replace('Accept','') + "_" 
                                                   + ReferenceBenchmark.tostring( ref ), 
                                                   ref, *refArgs ) )
    refBenchmarkCol.append( refBenchmarkList )
  del effArchieve
  call_kw['refBenchmarkCol'] = refBenchmarkCol
elif args.redo_decision_making or (args.redo_decision_making  in (None,NotSet) and args.data):
  if args.pile_up_ref in (None,NotSet):
    mainLogger.fatal("Cannot redo decision making without specifying --pile-up-ref.")

stat = CrossValidStatAnalysis( 
    args.discrFiles
    , binFilters = args.binFilters
    , binFilterIdxs = args.binFilterIdx
    , level = args.output_level
    )

    # Optional Arguments
stat( outputName              = args.outputFileBase
    , doMonitoring            = args.doMonitoring
    , doCompress              = args.doCompress
    , toMatlab                = args.doMatlab
    , test                    = args.test
    , epsCol                  = args.epsilon
    , aucEpsCol               = args.AUC_epsilon
    , rocPointChooseMethodCol = args.roc_method
    , modelChooseMethodCol    = args.model_method
    , modelChooseInitMethod   = args.init_model_method
    , expandOP                = args.expandOP
Beispiel #2
0
import numpy as np
outputDict = dict()
for idx, tuningName in enumerate(tuningNameList):
    files = expandFolders(basepath + '/' + pathList[idx])
    crossValGrid = []
    for path in files:
        if path.endswith('.pic'):
            crossValGrid.append(path)

    pprint(crossValGrid)
    pprint(configList[idx])
    pprint(refBenchmarkList[idx])
    c = CrossValidStatAnalysis.exportDiscrFiles(
        crossValGrid,
        RingerOperation.L2,
        triggerChains=tuningName,
        refBenchCol=refBenchmarkList[idx],
        EtBins=etBins,
        EtaBins=etaBins,
        configCol=configList[idx])

    mainLogger.info('%d bins found in this tuning: %s',
                    len(c[tuningName].keys()), tuningName)

    for etIdx in range(len(etBins) - 1):
        for etaIdx in range(len(etaBins) - 1):
            thr = c[tuningName][('et%d_eta%d') %
                                (etIdx, etaIdx)]['discriminator']['threshold']
            if np.abs(thrRelax[idx]) > 0:
                if (np.abs(thr + thrRelax[idx]) < 0.95):
                    c[tuningName][('et%d_eta%d') % (
                        etIdx,
Beispiel #3
0
import numpy as np
outputDict=dict()
for idx, tuningName in enumerate(tuningNameList):
  files = expandFolders(basepath+'/'+pathList[idx])
  crossValGrid=[]
  for path in files:
    if path.endswith('.pic'):
      crossValGrid.append(path)
  
  pprint(crossValGrid)
  pprint(configList[idx])
  pprint(refBenchmarkList[idx])
  c = CrossValidStatAnalysis.exportDiscrFiles(crossValGrid,
                                              RingerOperation.L2,
                                              triggerChains=tuningName,
                                              refBenchCol=refBenchmarkList[idx],
                                              EtBins = etBins,
                                              EtaBins = etaBins,
                                              configCol=configList[idx])

  mainLogger.info('%d bins found in this tuning: %s',len(c[tuningName].keys()),tuningName)
  
  for etIdx in range(len(etBins)-1):
    for etaIdx in range(len(etaBins)-1):
      thr = c[tuningName][('et%d_eta%d')%(etIdx,etaIdx)]['discriminator']['threshold']
      if np.abs(thrRelax[idx])>0:
        if (np.abs(thr+thrRelax[idx])<0.95):
          c[tuningName][('et%d_eta%d')%(etIdx,etaIdx)]['discriminator']['threshold'] += thrRelax[idx]
          mainLogger.warning('Relax threshold %f of (etBin = %d, etaBin = %d) to %f', thr, etIdx, etaIdx, thr+thrRelax[idx])

Beispiel #4
0
referenceBenchCol = [['Pd','SP','Pf'],
                     ['Pd','SP','Pf'],
                     ['Pd','SP','Pf']]

# Et Bins
etBins       = [ 20, 30, 40, 50, 500000 ]
# Eta bins
etaBins      = [ 0, 0.8 , 1.37, 1.54, 2.5 ]

# [Tight, Medium, Loose and VeryLoose]
thrRelax     = [0,0,0,0]

####################### Extract Ringer Configuration #########################
import numpy as np
for path, referenceBench, configCol in zip(pathList, referenceBenchCol, configList):
  files = expandFolders( os.path.join( basepath, path ), '*.pic.gz')
  for conf, ref in zip(configCol, referenceBench):
    refBenchmark =  [[ref] * len(conf)]*len(conf[0])
    c = CrossValidStatAnalysis.exportDiscrFiles( sorted(files)
                                               , RingerOperation.Offline
                                               , refBenchCol   = ref
                                               , EtBins        = etBins
                                               , EtaBins       = etaBins
                                               , configCol     = conf
                                               #, level         = LoggingLevel.VERBOSE
                                               )
###########################################################################



Beispiel #5
0
referenceBenchCol = [['Pd','SP','Pf'],
                     ['Pd','SP','Pf'],
                     ['Pd','SP','Pf']]

# Et Bins
etBins       = [ 20, 30, 40, 50, 500000 ]
# Eta bins
etaBins      = [ 0, 0.8 , 1.37, 1.54, 2.5 ]

# [Tight, Medium, Loose and VeryLoose]
thrRelax     = [0,0,0,0]

####################### Extract Ringer Configuration #########################
import numpy as np
for path, referenceBench, configCol in zip(pathList, referenceBenchCol, configList):
  files = expandFolders( os.path.join( basepath, path ), '*.pic')
  for conf, ref in zip(configCol, referenceBench):
    refBenchmark =  [[ref] * len(conf)]*len(conf[0])
    c = CrossValidStatAnalysis.exportDiscrFiles( sorted(files)
                                               , RingerOperation.Offline
                                               , refBenchCol   = ref
                                               , EtBins        = etBins
                                               , EtaBins       = etaBins
                                               , configCol     = conf
                                               #, level         = LoggingLevel.VERBOSE
                                               )
###########################################################################



Beispiel #6
0
import numpy as np
outputDict = dict()

files = expandFolders(basepath)
crossValGrid = []
for path in files:
    if path.endswith('.pic.gz'):
        crossValGrid.append(path)

pprint(crossValGrid)
pprint(configList[0])
pprint(refBenchmarkList[0])
d = CrossValidStatAnalysis.exportDiscrFiles(crossValGrid,
                                            RingerOperation.L2,
                                            triggerChains=tuningNameList[0],
                                            refBenchCol=refBenchmarkList[0],
                                            nEtBins=len(etBins),
                                            nEtaBins=len(etaBins),
                                            configCol=configList[0])

print d.keys()

from copy import copy
for tuningName in tuningNameList:
    c = {tuningName: copy(d[tuningNameList[0]])}
    mainLogger.info('%d bins found in this tuning: %s',
                    len(c[tuningName].keys()), tuningName)
    outputDict.update(c)

####################### Write Ringer Configuration #########################
Beispiel #7
0
pidnames = [
    ['Medium', 'VeryLoose'],
    ['Medium'],
    ['Medium', 'VeryLoose'],
    ['Tight', 'Medium', 'Loose', 'VeryLoose'],
    ['Medium', 'VeryLoose'],
]

####################### Extract Ringer Configuration #########################

for idx, cv in enumerate(crossval):

    tpath = os.getcwd() + '/' + tuningdirs[idx]
    mkdir_p(tpath)

    for jdx, pid in enumerate(pidnames[idx]):

        files = expandFolders(basepath + '/' + cv[jdx])
        crossValGrid = []
        for path in files:
            if path.endswith('.pic.gz'):
                crossValGrid.append(path)

        d = CrossValidStatAnalysis.exportDiscrFilesToOnlineFormat(
            crossValGrid,
            refBenchCol=ref,
            discrFilename='%s/ElectronRinger%sConstants' % (tpath, pid),
            thresFilename='%s/ElectronRinger%sThresholds' % (tpath, pid),
            version=4,
        )