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


Python DHadTable.output_org方法代码示例

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


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

示例1: files

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import output_org [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

示例2: create_fig_mode

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import output_org [as 别名]
def create_fig_mode(opts, tag, datatype, mode, lowmass, highmass, label):
    modekey = tools.get_modekey(mode)
    comname = '%s_%s' %(datatype.replace('/', '_'), mode)
    
    prefix = 'dir_%s/kkmass/%s_%s' % (label, lowmass, highmass)
    epsfile = tools.set_file('eps', datatype, modekey, tag,
                            prefix=prefix, extbase=attr.figpath)
    
    txtfile = tools.set_file('txt', datatype, modekey, tag,
                            prefix=prefix, extbase=attr.fitpath)

    head, figname = os.path.split(epsfile)
    figname = figname.replace('.eps', '')

    subdir = 'kkmass/%s_%s' % (lowmass, highmass)
    pdflink = './%s/%s.pdf' %(subdir, figname)
    pnglink = './%s/%s.png' %(subdir, figname)
    
    loglink = '[[../../log/%s/%s/%s.txt][log]]' %(label, subdir, comname)
    figlink = '[[%s][%s]]' %(pdflink, pnglink)
    
    modename = tools.get_orgname_from_fname(mode)
    secname = 'KK mass: %s - %s' % (lowmass, highmass)
    tablink = ''
    if os.access(txtfile, os.F_OK):
        orgtabfile = txtfile.replace('.txt', '.org')
        tab = DHadTable(txtfile)
        tab.output_org(orgtabfile)
        tablink = '#+INCLUDE: "%s"\n' % orgtabfile

    msg = '\n* %s \n  %s \n\n%s\n %s\n' % (
        secname, figlink, tablink, loglink)
        
    return msg
开发者ID:xshi,项目名称:dhad,代码行数:36,代码来源:kkmass.py

示例3: create_fig_mode

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import output_org [as 别名]
def create_fig_mode(tag, dt_type, mode, label):
    if tag == 'single':
        modename = attr.modes[mode]['orgname']
    else:
        if mode == 'double_all_d0s':
            modename = 'Double all D0s'
        elif mode == 'double_all_dps':
            modename = 'Double all Dps'
        else:
            mode1 = mode[0]
            mode2 = mode[1]
            modename = '%s, %s' % (attr.modes[mode1]['orgname'],
                                   attr.modes[mode2]['orgnamebar'])

    prefix = 'dir_' + label
    epsfile = tools.set_file('eps', dt_type, mode, tag,
                             prefix=prefix, extbase=attr.figpath)

    head, tail = os.path.split(epsfile)
    comname = tail.replace('.eps', '')
    figlabel = label.split('/')[0]
    relpath = label.replace(figlabel, '')
    
    pdflink = '.%s/%s.pdf' %(relpath, comname)
    pnglink = '.%s/%s.png' %(relpath, comname)
    loglink = '[[../../log/%s/%s.txt][log]]' %(label, comname)
    figlink = '[[%s][%s]]' %(pdflink, pnglink)
    fitpath = attr.fitpath
    tabfile = tools.set_file('txt', dt_type, mode, tag,
                             prefix=prefix, extbase=fitpath)

    if os.access(tabfile, os.F_OK):
        orgtabfile =  tools.set_file('org', dt_type, mode, tag,
                                     prefix=prefix, extbase=fitpath)
        tab = DHadTable(tabfile)
        tab.output_org(orgtabfile)
        abspath = os.path.join(attr.base)#, attr.analysis)
        orgtabfile = orgtabfile.replace(abspath, '../..')
        tablink = '#+INCLUDE: "%s"\n' % orgtabfile
        msg = '\n* %s \n  %s \n\n%s\n %s\n' % (
            modename, figlink, tablink, loglink)
    else:
        sys.stdout.write('File does not exist: %s \n' %tabfile)
        sys.stdout.write('Skipping mode %s ... \n' % str(mode))
        msg = '\n* %s \n Skipped.\n'  % modename
        
    return msg
开发者ID:xshi,项目名称:dhad,代码行数:49,代码来源:__init__.py

示例4: create_fig_mode

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import output_org [as 别名]
def create_fig_mode(tag, datatype, mode, label):
    if tag != 'single':
        raise NameError(tag)
        
    comname = '%s_%s' %(datatype.replace('/', '_'), mode)

    epspath = os.path.join(attr.figpath, label)    
    epsname = '%s.eps' % comname
    epsfile = os.path.join(epspath, epsname)

    txtpath = os.path.join(attr.fitpath(), label)    
    txtname = '%s.txt' % comname
    txtfile = os.path.join(txtpath, txtname)

    pdflink = './%s/%s.pdf' %(label, comname)
    pnglink = './%s/%s.png' %(label, comname)
    loglink = '[[../log/%s/backgrounds/%s.txt][log]]' %(label, comname)

    figlink = '[[%s][%s]]' %(pdflink, pnglink)

    modename = tools.get_orgname_from_fname(mode)

    tablink = ''
    if os.access(txtfile, os.F_OK):
        orgtabfile = txtfile.replace('.txt', '.org')
        tab = DHadTable(txtfile)
        tab.output_org(orgtabfile)

        abspath = os.path.join(attr.base, attr.analysis)
        orgtabfile = orgtabfile.replace(abspath, '..')

        tablink = '#+INCLUDE: "%s"\n' % orgtabfile

    msg = '\n* %s \n  %s \n\n%s\n %s\n' % (
        modename, figlink, tablink, loglink)

    return msg
开发者ID:xshi,项目名称:dhad,代码行数:39,代码来源:backgrounds.py

示例5: create_fig_diag_mode

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import output_org [as 别名]
def create_fig_diag_mode(dt_type, stage, label, mode, sign):

    prefix='dir_'+label

    if sign == 1:
        uname = modes[mode]['uname']
        fname = modes[mode]['fname']
        title = modes[mode]['orgname']
    else:
        uname = modes[mode]['unamebar']
        fname = modes[mode]['fnamebar']
        title = modes[mode]['orgnamebar']

    comname = '%s_Single_%s_fakes_Single_%s' % (dt_type, fname, fname)

    epsfile  = tools.set_file(extbase=attr.figpath,
                              prefix=prefix, comname=comname+'.eps')

    pdffile  = epsfile.replace('.eps', '.pdf')

    figlabel = label.split('/')[0]
    relpath = label.replace(figlabel, '')

    pdflink = '.%s/%s.pdf' %(relpath, comname)
    pnglink = '.%s/%s.png' %(relpath, comname)

    if not os.access(pdffile, os.F_OK):
        if not os.access(epsfile, os.F_OK):
            sys.stdout.write('epsfile is not ready for (%s %s) \n' % (mode, sign))
        else:
            tools.eps2png(epsfile)
            tools.eps2pdf(epsfile)


    figlink = '[[%s][%s]]' %(pdflink, pnglink)
    
    txtfile  = tools.set_file(extbase=attr.fitpath,
                              prefix=prefix, comname=comname+'.txt')


    logname = 'stage_%s_%s_%s.txt' %(stage, mode, sign)
    logfile = tools.set_file(extbase=attr.logpath,
                              prefix=prefix, comname=logname)
    loglink = ''
    if os.access(logfile, os.F_OK):
        loglink = '[[../../log/%s/%s][log]]' %(label, logname)

    tablink = ''
    if os.access(txtfile, os.F_OK):
        orgtabfile = txtfile.replace('.txt', '.org')
        tab = DHadTable(txtfile)
        tab.output_org(orgtabfile)

        abspath = os.path.join(attr.base)#, attr.analysis)
        orgtabfile = orgtabfile.replace(abspath, '../..')

        tablink = '#+INCLUDE: "%s"\n' % orgtabfile

    msg = '\n* %s \n  %s \n\n%s\n %s\n' % (
        title, figlink, tablink, loglink)

    return msg
开发者ID:xshi,项目名称:dhad,代码行数:64,代码来源:crossfeeds.py

示例6: create_fig_nondiag_mode

# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import output_org [as 别名]
def create_fig_nondiag_mode(dt_type, stage, label, x, y):
    prefix='dir_'+label
    if x[1] == 1:
        uname = modes[x[0]]['uname']
        fname = modes[x[0]]['fname']
        title1 = modes[x[0]]['orgname']
    else:
        uname = modes[x[0]]['unamebar']
        fname = modes[x[0]]['fnamebar']
        title1 = modes[x[0]]['orgnamebar']

    if y[1] == 1:
        unameb = modes[y[0]]['uname']
        fnameb = modes[y[0]]['fname']
        title2 = modes[y[0]]['orgname']
    else:
        unameb = modes[y[0]]['unamebar']
        fnameb = modes[y[0]]['fnamebar']
        title2 = modes[y[0]]['orgnamebar']

    title = '%s fakes %s' % (title1, title2)

    comname = '%s_Single_%s_fakes_Single_%s' % (dt_type, fname, fnameb)

    epsfile  = tools.set_file(extbase=attr.figpath,
                              prefix=prefix, comname=comname+'.eps')

    pdffile  = epsfile.replace('.eps', '.pdf')
    
    figlabel = label.split('/')[0]
    relpath = label.replace(figlabel, '')
    pdflink = '.%s/%s.pdf' %(relpath, comname)
    pnglink = '.%s/%s.png' %(relpath, comname)

    if not os.access(pdffile, os.F_OK):
        if not os.access(epsfile, os.F_OK):
            sys.stdout.write('epsfile is not ready for %s, %s \n' % (x, y))
        else:
            sys.stdout.write('Converting %s ...' % epsfile)
            tools.eps2png(epsfile)
            tools.eps2pdf(epsfile)
            sys.stdout.write(' OK.\n')
        
    figlink = '[[%s][%s]]' %(pdflink, pnglink)
    
    txtfile  = tools.set_file(extbase=attr.fitpath,
                              prefix=prefix, comname=comname+'.txt')
    xstr = pair_to_str(x)
    ystr = pair_to_str(y)
    
    logname = 'stage_%s_%s_%s.txt' %(stage, xstr,ystr)
    logfile = tools.set_file(extbase=attr.logpath,
                              prefix=prefix, comname=logname)
    if not os.access(epsfile, os.F_OK):
        sys.stdout.write('Please check log: %s\n' % logfile)

    loglink = ''
    if os.access(logfile, os.F_OK):
        loglink = '[[../../log/%s/%s][log]]' %(label, logname)
    tablink = ''

    if os.access(txtfile, os.F_OK):
        orgtabfile = txtfile.replace('.txt', '.org')
        tab = DHadTable(txtfile)
        tab.output_org(orgtabfile)

        abspath = os.path.join(attr.base)#, attr.analysis)
        orgtabfile = orgtabfile.replace(abspath, '../..')

        tablink = '#+INCLUDE: "%s"\n' % orgtabfile

    msg = '\n* %s \n  %s \n\n%s\n %s\n' % (
        title, figlink, tablink, loglink)

    return msg
开发者ID:xshi,项目名称:dhad,代码行数:77,代码来源:crossfeeds.py


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