本文整理汇总了Python中tools.DHadTable.column_append_from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python DHadTable.column_append_from_dict方法的具体用法?Python DHadTable.column_append_from_dict怎么用?Python DHadTable.column_append_from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools.DHadTable
的用法示例。
在下文中一共展示了DHadTable.column_append_from_dict方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: para_md
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_from_dict [as 别名]
def para_md(args):
para = 'md'
namestyle = 'fname'
rnd = '0.0000001'
tag = 's'
tab_A = args[0]
tab_B = args[1]
latel_A = tab_A
latel_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_fit_files(label_A, tab_A, para, tag, rnd)
tab.column_append_from_fit_files(label_B, tab_B, para, tag, rnd)
tab.column_append_by_diff('diff[MeV]', label_B,label_A, rnd=rnd, factor=1000)
tab.output(_tabname)
示例2: divide_yields
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_from_dict [as 别名]
def divide_yields(args):
if args[0] not in ['signal', 'data'] :
raise NameError(args)
variable = 'yields'
rnd='.01'
dt_type = args[0]
tag = args[1]
tab_A = args[2]
tab_B = args[3]
label_A, fitbase_A, prefix_A = tools.parse_tabname(_opts, tab_A)
label_B, fitbase_B, prefix_B = tools.parse_tabname(_opts, tab_B)
sys.stdout.write('dhad.tab : Divide %s of %s by %s:' %(
variable, tab_A, tab_B))
tab = DHadTable()
namestyle = 'fname,fnamebar'
tab.column_append_from_dict('Mode', namestyle)
tab.column_append_from_files(label_A, 'N1,N2', fitbase_A, prefix_A,
dt_type, tag ,'txt', rnd='1.')
tab.column_append_from_files(label_B, 'N1,N2', fitbase_B, prefix_B,
dt_type, tag ,'txt', rnd='1.')
tab.column_append_by_divide('%s/%s' %(label_A, label_B), label_A,
label_B, rnd=rnd, err_type='Indp')
tab.output(_tabname)
示例3: para_argus
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_from_dict [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)
示例4: yields
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_from_dict [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)
示例5: evtfile
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_from_dict [as 别名]
def evtfile(args):
if args[0] not in ['signal', 'data'] :
raise NameError(args)
variable = 'yields'
dt_type = args[0]
tag = args[1]
evt_A = args[2]
evt_B = args[3]
label_A, evtbase_A, prefix_A = tools.parse_evtname(opts, evt_A)
label_B, evtbase_B, prefix_B = tools.parse_evtname(opts, evt_B)
filelist_A = tools.set_file_list(evtbase_A, prefix_A, dt_type, tag, 'evt')
filelist_B = tools.set_file_list(evtbase_B, prefix_B, dt_type, tag, 'evt')
zipped = zip(filelist_A, filelist_B)
for f in zipped:
fa = f[0]
fb = f[1]
diff = tools.diff(fa, fb)
print diff
sys.exit()
sys.stdout.write('dhad.tab : Compare %s between %s and %s:' %(
variable, tab_A, tab_B ))
tab = DHadTable()
namestyle = 'fname,fnamebar'
tab.column_append_from_dict('Mode', namestyle)
tab.column_append_from_files(label_A, 'N1,N2', fitbase_A, prefix_A,
dt_type, tag ,'txt', rnd='1.')
tab.column_append_from_files(label_B, 'N1,N2', fitbase_B, prefix_B,
dt_type, tag ,'txt', rnd='1.')
tab.column_append_by_diff_sigma_pct('diff(%)', label_B,label_A, rnd=rnd)
tab.output(_tabname)
示例6: fsr_syst
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_from_dict [as 别名]
def fsr_syst(args):
'''
--------------------
FSR systematics
--------------------
'''
tab_name = 'FSR_syst'
tabbase = os.path.join(attr.base, '7.06', 'tab')
tab = DHadTable()
tab.column_append_from_dict('Mode', 'fname,fnamebar')
tab_file = os.path.join(tabbase, 'noFSR_single_signal_eff.txt')
columnA = 'Efficiency without FSR(%)'
tab.column_append_from_tab_file(columnA, tab_file)
columnB = 'Efficiency with FSR(%)'
tab.column_append_from_tab_file(columnB, tab_file)
tab.column_append_by_diff('diff(%)', columnA, columnB, factor=100)
tab.column_append_by_times_number('diff X 30%', 'diff(%)', '0.3',
rnd='.01')
tab.rows_join_by_max('diff X 30%')
tab.output(tab_name)
示例7: signal_line_shape_syst
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import column_append_from_dict [as 别名]
def signal_line_shape_syst(args):
'''
--------------------------------------------------
Signal line shape systematics
--------------------------------------------------
'''
tab_name = 'signal_line_shape_syst'
tabbase = os.path.join(attr.base, '7.06', 'tab')
tab = DHadTable()
tab.column_append_from_dict('Mode', 'fname,fnamebar')
tab_file_A = os.path.join(
tabbase, 'yields_M_3.7713_regular_M_3.7723_data_Single.txt')
name_A = 'Mass(+/-0.5 MeV)%'
column = 'max-diff(%)'
tab.column_append_from_tab_file(name_A, tab_file_A, column)
tab_file_B = os.path.join(
tabbase, 'yields_Gamma_0.0261_regular_Gamma_0.0311_data_Single.txt')
name_B = 'Gamma(+/-2.5 MeV)%'
tab.column_append_from_tab_file(name_B, tab_file_B, column)
tab_file_C = os.path.join(
tabbase, 'yields_R_8.3_regular_R_16.3_data_Single.txt')
name_C = 'R(+/- 4)%'
tab.column_append_from_tab_file(name_C, tab_file_C, column)
name_D = 'Total(%)'
tab.column_append_by_add_quadrature3(name_D, name_A,
name_B, name_C, rnd='.01')
tab.rows_join_by_max(name_D)
tab.output(tab_name)