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


Python DHadTable.row_append方法代码示例

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


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

示例1: events

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def events(args):
    parsed = yld.parse_args(args)
    datatype = parsed[0]
    tag = parsed[1]
    modes = parsed[2]
    label = parsed[3]

    unique_evt_label = label 
    if _set and 'events' in _set:
        unique_evt_label = _set.split('=')[1]

    tab = DHadTable()

    row = ['Mode']
    row.extend(attr.datasets_281)
    tab.row_append(row)

    for mode in modes:
        modename = mode.replace('Single_', '')
        evtfile = get_unique_evtfile(
            datatype, mode, unique_evt_label, debug=_debug)
        f = EventsFile(evtfile)
        row = map(str, f.datasets_sorted)
        row.insert(0, modename)
        tab.row_append(row)

    tab.output(_tabname)
开发者ID:xshi,项目名称:dhad,代码行数:29,代码来源:parse.py

示例2: events

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def events(args):

    parsed = yld.parse_args(args)
    datatype  = parsed[0]
    tag       = parsed[1]
    modes     = parsed[2]
    label_A   = parsed[3]
    label_B  = args[3]

    datpath = attr.datpath
    tab = DHadTable()
    tab.row_append(['Mode', label_A, label_B, 'Common',
                    'Unique(%s)' %label_A, 'Unique(%s)' %label_B ])
    tab.head = tab.data[0]
    for mode in modes:
        modename = mode.replace('Single_', '')
        evtname = datatype + '_' + mode + '.evt'
        evtpath_A = os.path.join(datpath, 'evt', label_A, 'events')
        evtfile_A = os.path.join(evtpath_A, evtname)
        f_A = UserFile(evtfile_A)
        events_A = Set(f_A.data)
        evtpath_B = os.path.join(datpath, 'evt', label_B, 'events')
        evtfile_B = os.path.join(evtpath_B, evtname)
        f_B = UserFile(evtfile_B)
        events_B = Set(f_B.data)
        events_inter = events_A & events_B
        entries_A = len(events_A)
        entries_B = len(events_B)
        common = len(events_inter)
        unique_A = len(events_A - events_inter)
        unique_B = len(events_B - events_inter)
        row = [modename, entries_A, entries_B, common, unique_A, unique_B]
        tab.row_append(map(str, row))
    tab.output(_tabname)
开发者ID:xshi,项目名称:dhad,代码行数:36,代码来源:compare.py

示例3: files

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def files(args):

    if args[0].startswith('/'):
        dira = args[0]
    else:
        dira = os.path.join(attr.base, args[0])

    if  args[1].startswith('/'):
        dirb = args[1]
    else:
        dirb = os.path.join(attr.base, args[1])

    d = filecmp.dircmp(dira, dirb)

    sys.stdout.write('There are %s different files. \n' % len(d.diff_files))

    tab = DHadTable()
    tab.row_append(['FileName', 'A', 'B'])

    for f in d.diff_files:
        filea = os.path.join(dira, f)
        fileb = os.path.join(dirb, f)

        tab.row_append_from_files(f, [filea, fileb])

    tab.output_org()
开发者ID:xshi,项目名称:dhad,代码行数:28,代码来源:compare.py

示例4: entries

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def entries(args):
    dt_type = args[0]
    tag = args[1]
    label_A = args[2]
    label_B = args[3]

    evtpath = attr.evtpath
    rnd='.01'
    err_type=None
    label = None
    diff = 'pct'
    
    tab = DHadTable()
    tab.row_append(['Mode', label_A, label_B])
    tab.head = tab.data[0]
    for mode in attr.modes:
        for sign in [1, -1]:
            evtfile_A = tools.set_file('evt', dt_type, mode, tag, sign=sign,
                                       prefix='dir_'+label_A, extbase=evtpath)
            evtfile_B = tools.set_file('evt', dt_type, mode, tag, sign=sign,
                                       prefix='dir_'+label_B, extbase=evtpath)
            entries_A = tools.count_lines(evtfile_A)
            entries_B = tools.count_lines(evtfile_B)
            if sign == 1:
                modename = attr.modes[mode]['fname']
            else:
                modename = attr.modes[mode]['fnamebar']
            row = [modename, entries_A, entries_B]
            tab.row_append(map(str, row))

    tab.column_append_by_diff_pct('diff(%)', label_B,label_A, rnd=rnd, err_type=err_type)
    tab.output(_tabname)
开发者ID:xshi,项目名称:dhad,代码行数:34,代码来源:compare.py

示例5: make_overview_table

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def make_overview_table(tabname, datatype, modes, label, test=False):
    tab = DHadTable()
    tab.row_append(['Mode', 'Backgrounds'])
    for mode in modes:
        modename = mode.replace('Single_', '')
        bkgtable = get_bkg_tab_link(datatype, mode, label)
        line = [modename, bkgtable]
        tab.row_append(line)
    tab.output(tabname, test=test)
开发者ID:xshi,项目名称:dhad,代码行数:11,代码来源:backgrounds.py

示例6: bkg_generic_cont

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def bkg_generic_cont(tabname, datatype, tag, modes,
                     label, test, debug):
    tab = DHadTable()
    row = ['Mode', 'Continuum Backgrounds']
    tab.row_append(row)
    for mode in modes:
        new_row = bkg_cont_single_mode(datatype, mode, label, debug)
        tab.row_append(new_row)

    tab.output(tabname, test=test)
开发者ID:xshi,项目名称:dhad,代码行数:12,代码来源:backgrounds.py

示例7: bkg_generic_ddbar

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def bkg_generic_ddbar(tabname, datatype, tag, modes, label, test, debug):
    ranges = ['>0', '>50', '>100', '>200', '>500',
                  '>1000', '>2000', '>3000']

    tab = DHadTable()
    row = ['Mode', 'Backgrounds']
    row.extend(ranges)
    tab.row_append(row)

    for mode in modes:
        new_row = bkg_ddbar_single_mode(datatype, mode, label, ranges, debug)
        tab.row_append(new_row)

    tab.output(tabname, test=test)
开发者ID:xshi,项目名称:dhad,代码行数:16,代码来源:backgrounds.py

示例8: evt

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def evt(opts, args):
    tabname = 'entries_evt_' + '_'.join(args).replace('/', '_')

    if args[0] == 'log':
        return evt_log(args[1:])
    
    if args[0] not in ['data'] :
	raise NameError(args)

    dt_type = args[0]
    tag = args[1]
    label = args[2]

    evtpath = attr.evtpath()
    if '/' in label:
        ver = label.split('/')[0]
        label = label.split('/')[1]
        evtpath = attr.evtpath(ver)
        
    prefix = 'dir_' + label

    tab = DHadTable()
    tab.row_append(['Mode', 'fname', 'fnamebar', 'combined', 'sum(theory)'])

    for mode in attr.modes:
        evtfile1 = tools.set_file('evt', dt_type, mode, tag, sign=-1,
                                  prefix=prefix, extbase=evtpath)
        evtfile2 = tools.set_file('evt', dt_type, mode, tag, sign=1,
                                  prefix=prefix, extbase=evtpath)
        evtfile_combined = tools.set_file('evt', dt_type, mode, tag,
                                          prefix=prefix, extbase=evtpath)
        entries1 = tools.count_lines(evtfile1)
        entries2 = tools.count_lines(evtfile2)

        sumup = entries1 + entries2
        
        entries_combined = tools.count_lines(evtfile_combined)
        row = [mode, entries1, entries2, entries_combined, sumup]
        
        tab.row_append(map(str, row))

    tab.output(tabname)
开发者ID:xshi,项目名称:dhad,代码行数:44,代码来源:entries.py

示例9: main

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def main(opts, args):

    if args[0] == 'names':
        return bkg_names(opts, args[1:])
    
    tabname = 'bkg_' + '_'.join(args).replace('/', '_')
    debug = opts.debug
    test = opts.test

    parsed = yld.parse_args(args)
    datatype  = parsed[0]
    tag       = parsed[1]
    modes     = parsed[2]
    label     = parsed[3]

    if args[0] == 'generic':
        return bkg_generic_ddbar(tabname, datatype,
                                 tag, modes, label, test, debug)
    elif args[0] == 'generic/cont':
        return bkg_generic_cont(tabname, datatype,
                                tag, modes, label, test, debug)
    elif args[0] == 'generic/ddbar':
        return bkg_generic_ddbar(tabname, datatype,
                                tag, modes, label, test, debug)

    tab = DHadTable()
    row = ['Mode', 'Number of DDbar Backgrounds',
           'Number of Continuum Backgrounds']
    tab.row_append(row)
    for mode in modes:
        modename = mode.replace('Single_', '')
        ddbarnum = get_bkg_total('generic/ddbar', mode, label, debug)
        contnum = get_bkg_total('generic/cont', mode, label, debug)
        row = [modename, ddbarnum, contnum]
        tab.row_append(row)

    tab.column_trim('Number of DDbar Backgrounds', rnd='1')
    tab.column_trim('Number of Continuum Backgrounds', rnd='1')
    tab.output(tabname, test=test)
开发者ID:xshi,项目名称:dhad,代码行数:41,代码来源:backgrounds.py

示例10: runs

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def runs(args):
    parsed = yld.parse_args(args)
    datatype = parsed[0]
    tag = parsed[1]
    modes = parsed[2]
    label = parsed[3]

    unique_evt_label = label 

    datatype = 'data'
    run_event_set = Set([])
    for mode in attr.single_mode_list:
        evtname = '%s_%s_unqiue_%s.evt' %(datatype, mode, label)
        evtpath = os.path.join(attr.datpath, 'evt', label, 'events')
        unique_file = os.path.join(evtpath, evtname)
        f = UserFile(unique_file)
        events = Set(f.data)
        run_event_set.update(events)


    fe = EventsFile()
    fe.data = list(run_event_set)
    fe.parse()

    tab = DHadTable()
    row = ['Dataset', 'Run', 'Number of Events']
    tab.row_append(row)
    for run, num in sorted(fe.runs.iteritems()):
        dataset = get_dataset_by_run(run)
        row = [dataset, run, num]
        tab.row_append(map(str, row))

    if _test:
        tab.output()
        sys.stdout.write('\ntest: Will write to %s\n' %_tabname)
    else:
        tab.output(_tabname)
开发者ID:xshi,项目名称:dhad,代码行数:39,代码来源:parse.py

示例11: draw_momenta_ks3pi

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import row_append [as 别名]
def draw_momenta_ks3pi(datatype, mode, label, test):
    modekey = tools.get_modekey(mode)
    sname = attr.modes[modekey]['sname'].lower()
    figname = '%s_momenta' % sname
    figpath = os.path.join(attr.figpath, label, 'trkmtm')
    epsfile = set_file(extbase=figpath, comname=figname, ext='eps')
    tab = DHadTable()
    tab.row_append(['Name', 'Data/MC'])
                   
    # --------------------------------------------------
    h_pks = {}; h_ppi1 = {}; h_ppi2 = {}; h_ppim = {}
    h_pks_c = {}; h_ppi1_c = {}; h_ppi2_c = {}; h_ppim_c = {}

    for datatype in datatype.split('/'):
        selfile = get_selfile(datatype, mode, label, test=test)
        selfile = selfile.replace('/trkmtm/', '/trkmtm2/')

        f = TFile(selfile)
        if datatype == 'signal' or datatype == 'generic':
            tp = 'mc'
        if datatype == 'data':
            tp = 'data'

        h_pks[tp]= f.Get('h_pks'+tp)
        h_ppi1[tp]= f.Get('h_ppi1'+tp)
        h_ppi2[tp]= f.Get('h_ppi2'+tp)
        h_ppim[tp]= f.Get('h_ppim'+tp)

        h_pks_c[tp]= f.Get('h_pk_c'+tp)
        h_ppi1_c[tp]= f.Get('h_ppi1_c'+tp)
        h_ppi2_c[tp]= f.Get('h_ppi2_c'+tp)
        h_ppim_c[tp]= f.Get('h_ppim_c'+tp)

        f.Clear()

    ratio = h_pks['data'].Integral()/h_pks['mc'].Integral()

    c1 = TCanvas('c1', 'canvas', 900, 900)
    c1.Divide(2,2)
    c1.cd(1)
    h_pks['data'].Draw('PE')
    h_pks['mc'].Scale(ratio)
    h_pks['mc'].Draw('SAME')
    c1.cd(2)
    h_ppi1['data'].Draw('PE')
    h_ppi1['mc'].Scale(ratio)
    h_ppi1['mc'].Draw('SAME')
    c1.cd(3)
    h_ppi2['data'].Draw('PE')
    h_ppi2['mc'].Scale(ratio)
    h_ppi2['mc'].Draw('SAME')
    c1.cd(4)
    h_ppim['data'].Draw('PE')
    h_ppim['mc'].Scale(ratio)
    h_ppim['mc'].Draw('SAME')

    c1.Print(epsfile)
    tools.eps2pdf(epsfile)

    # --------------------------------------------------
    c1.Clear()
    c1.Divide(2,2)

    c1.cd(1)
    h_pks_c['data'].Draw('PE')
    lratio = h_pks_c['data'].Integral()/h_pks_c['mc'].Integral()
    #print 'k:', lratio/ratio
    tab.row_append(['K', lratio/ratio])

    h_pks_c['mc'].Scale(lratio)
    h_pks_c['mc'].Draw('SAME,HIST')
    c1.cd(2)
    h_ppi1_c['data'].Draw('PE')
    lratio = h_ppi1_c['data'].Integral()/h_ppi1_c['mc'].Integral()
    #print 'pi1:', lratio/ratio
    tab.row_append(['pi1', lratio/ratio])

    h_ppi1_c['mc'].Scale(lratio)
    h_ppi1_c['mc'].Draw('SAME,HIST')
    c1.cd(3)
    h_ppi2_c['data'].Draw('PE')
    lratio = h_ppi2_c['data'].Integral()/h_ppi2_c['mc'].Integral()
    #print 'pi2:', lratio/ratio
    tab.row_append(['pi2', lratio/ratio])

    h_ppi2_c['mc'].Scale(lratio)
    h_ppi2_c['mc'].Draw('SAME,HIST')
    c1.cd(4)
    h_ppim_c['data'].Draw('PE')
    lratio = h_ppim_c['data'].Integral()/h_ppim_c['mc'].Integral()
    #print 'pim:', lratio/ratio
    tab.row_append(['pim', lratio/ratio])

    h_ppim_c['mc'].Scale(lratio)
    h_ppim_c['mc'].Draw('SAME,HIST')
    
    tab.column_trim('Data/MC', rnd='.0001')

    figname = '%s_momentacor' % sname
    epsfile = set_file(extbase=figpath, comname=figname, ext='eps')
#.........这里部分代码省略.........
开发者ID:xshi,项目名称:dhad,代码行数:103,代码来源:trkmtm1.py


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