示例#1
0
 def PrintHistsContents(self, cat, hlist):
     log.info(cat)
     row_template = [cat] + list(hlist[0][1].bins_range())
     out = StringIO()
     table = PrettyTable(row_template)
     for pair in hlist:
         pretty_bin_contents = map(prettyfloat, pair[1].y())
         table.add_row([pair[0]] + pretty_bin_contents)
     print >> out, '\n'
     print >> out, table.get_string(hrules=1)
     log.info(out.getvalue())
示例#2
0
 def PrintHistsContents(self, cat, hlist):
     log.info(cat)
     row_template = [cat] + list(hlist[0][1].bins_range())
     out = StringIO()
     table = PrettyTable(row_template)
     for pair in hlist:
         pretty_bin_contents = map(prettyfloat, pair[1].y())
         table.add_row([pair[0]] + pretty_bin_contents)
     print >> out, "\n"
     print >> out, table.get_string(hrules=1)
     log.info(out.getvalue())
示例#3
0
文件: classify.py 项目: qbuat/htt
def print_feature_ranking(clf, fields):
    importances = clf.feature_importances_
    indices = np.argsort(importances)[::-1]
    log.info("Feature ranking:")
    out = StringIO()
    print >> out
    print >> out
    print >> out, r"\begin{tabular}{c|c|c}"
    table = PrettyTable(["Rank", "Variable", "Importance"])
    print >> out, r"\hline\hline"
    print >> out, r"Rank & Variable & Importance\\"
    for f, idx in enumerate(indices):
        table.add_row([f + 1,
            fields[idx],
            '%.3f' % importances[idx]])
        print >> out, r"%d & %s & %.3f\\" % (f + 1,
            variables.VARIABLES[fields[idx]]['title'],
            importances[idx])
    print >> out, r"\end{tabular}"
    print >> out
    print >> out, table.get_string(hrules=1)
    log.info(out.getvalue())
示例#4
0
文件: classify.py 项目: mayoub/hhana
def print_feature_ranking(clf, fields):
    importances = clf.feature_importances_
    indices = np.argsort(importances)[::-1]
    log.info("Feature ranking:")
    out = StringIO()
    print >> out
    print >> out
    print >> out, r"\begin{tabular}{c|c|c}"
    table = PrettyTable(["Rank", "Variable", "Importance"])
    print >> out, r"\hline\hline"
    print >> out, r"Rank & Variable & Importance\\"
    for f, idx in enumerate(indices):
        table.add_row([f + 1,
            fields[idx],
            '%.3f' % importances[idx]])
        print >> out, r"%d & %s & %.3f\\" % (f + 1,
            variables.VARIABLES[fields[idx]]['title'],
            importances[idx])
    print >> out, r"\end{tabular}"
    print >> out
    print >> out, table.get_string(hrules=1)
    log.info(out.getvalue())
示例#5
0
             'lumi': 2392.85,
             'triggers': 'EF_tau29_medium1_tau20_medium1 && L1_2TAU11_TAU15'},
}
"""

PERIODS = {
    'B2-M': {'runs': (178044, 191933),
             'lumi': 4604.52}, #4617.}, #4661.2},
}

#LUMI = { # pb-1 atlas-lumicalc.cern.ch
#    2011: 4604.52, # B2-M skim v9
#    2012: 20298.4 #14220.7, #14130.8, # A3-E no run 200841 skim v9
#}
# 20298.4

if __name__ == '__main__':

    total_lumi = 0
    lumi_table = PrettyTable(['Period(s)', 'Runs', 'Lumi [pb-1]'])
    #trigger_table = PrettyTable(['Period(s)', 'Triggers'])
    for period in sorted(PERIODS.keys()):
        info = PERIODS[period]
        lumi_table.add_row([period, '%i-%i' % info['runs'], '%.3f' % info['lumi']])
        #trigger_table.add_row([period, info['triggers'].replace('||', 'OR').replace('&&', 'AND')])
        total_lumi += info['lumi']
    print lumi_table.get_string(hrules=1)
    print "total lumi: %.3f pb-1" % total_lumi
    #print
    #print trigger_table.get_string(hrules=1)