本文整理汇总了Python中tools.DHadTable.column_append_by_diff_pct方法的典型用法代码示例。如果您正苦于以下问题:Python DHadTable.column_append_by_diff_pct方法的具体用法?Python DHadTable.column_append_by_diff_pct怎么用?Python DHadTable.column_append_by_diff_pct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools.DHadTable
的用法示例。
在下文中一共展示了DHadTable.column_append_by_diff_pct方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: entries
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_by_diff_pct [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)
示例2: para_argus
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_by_diff_pct [as 别名]
def para_argus(para, args):
namestyle = 'fname'
rnd = '0.01'
tag = 's'
rowName = para
extbase = attr.fitbase
ext = 'txt'
dt_type = args[0]
tab_A = args[1]
tab_B = args[2]
label_A = tab_A
label_B = tab_B
label = tools.parseopts_set(opts.set, 'label')
if label:
labels = label.split(',')
label_A = labels[0]
label_B = labels[1]
tab = DHadTable()
tab.column_append_from_dict('Mode', namestyle)
tab.column_append_from_files(label_A, rowName, extbase, 'dir_'+tab_A,
dt_type, tag, ext, rnd=rnd)
tab.column_append_from_files(label_B, rowName, extbase, 'dir_'+tab_B,
dt_type, tag, ext, rnd=rnd)
tab.column_append_by_diff_pct('diff(%)', label_B, label_A, rnd=rnd)
tab.output(_tabname)
示例3: yields
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_by_diff_pct [as 别名]
def yields(opts, tabname, args):
if args[0] not in ['signal', 'data'] :
raise NameError(args)
rnd='.01'
err_type=None
diff = 'pct'
sign = 1
if opts.set:
for li in opts.set.split(':'):
name = li.split('=')[0]
value = li.split('=')[1]
sys.stdout.write('Set %s = %s \n' % (name, value))
if name == 'diff':
diff = value
if name == 'err_type':
err_type = value
if name == 'sign':
sign = value
variable = 'yields'
dt_type = args[0]
tag = args[1]
label_A = args[2]
label_B = args[3]
fitbase = attr.fitbase
sys.stdout.write('dhad.tab : Compare %s between %s and %s:\n' %(
variable, label_A, label_B ))
tab = DHadTable()
namestyle = 'fname,fnamebar'
tab.column_append_from_dict('Mode', namestyle)
tab.column_append_from_files(label_A, 'N1,N2', fitbase, 'dir_%s' %label_A,
dt_type, tag ,'txt', rnd='1.')
tab.column_append_from_files(label_B, 'N1,N2', fitbase, 'dir_%s' %label_B,
dt_type, tag ,'txt', rnd='1.')
if sign == '0':
tab.rows_join_by_average(rnd='1.')
if diff == 'pct':
tab.column_append_by_diff_pct(
'diff(%)', label_B,label_A, rnd=rnd, err_type=err_type)
elif diff == 'sigma_pct':
tab.column_append_by_diff_sigma_pct('diff(%)', label_B,label_A, rnd=rnd)
elif diff == 'sigma2_pct':
tab.column_append_by_diff_sigma2_pct('diff(%)', label_B,label_A, rnd=rnd)
elif diff == 'ratio':
tab.column_append_by_divide(
'ratio', label_B,label_A, rnd=rnd, err_type='Indp')
else:
raise NameError(diff)
tab.output(tabname, test=opts.test)