本文整理汇总了Python中tools.DHadTable类的典型用法代码示例。如果您正苦于以下问题:Python DHadTable类的具体用法?Python DHadTable怎么用?Python DHadTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DHadTable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: parsefile
def parsefile(f, lowmass, highmass, indict):
x0 = lowmass
x1 = highmass
xc = (x0 + x1)/2.
tab = DHadTable(f)
N1 = float(tab.cell_get('N1', 'Value'))
N2 = float(tab.cell_get('N2', 'Value'))
if N1 > 1000 or N2 > 1000 :
return
indict['x'].append(xc)
indict['exl'].append(xc-x0)
indict['exh'].append(x1-xc)
N = N1 + N2
err_low_N1 = float(tab.cell_get('N1', 'Low'))
err_low_N2 = float(tab.cell_get('N2', 'Low'))
err_low = (err_low_N1**2 + err_low_N2**2)**.5
err_high_N1 = float(tab.cell_get('N1', 'High'))
err_high_N2 = float(tab.cell_get('N2', 'High'))
err_high = (err_high_N1**2 + err_high_N2**2)**.5
yc = float(N)
yl = float(err_low)
yh = float(err_high)
indict['y'].append(yc)
indict['eyl'].append(yl)
indict['eyh'].append(yh)
开发者ID:xshi,项目名称:dhad,代码行数:34,代码来源:compare.py
示例2: entries
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,代码行数:32,代码来源:compare.py
示例3: create_fig_mode
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,代码行数:34,代码来源:kkmass.py
示例4: get_generated_numbers_single
def get_generated_numbers_single(i, prefix=''):
if '281ipb' in prefix:
mult_fact = 10
elif '537ipb' in prefix:
mult_fact = 20
elif '818ipb' in prefix or 'v13' in prefix:
mult_fact = 30
else:
raise NameError(prefix)
mode = i[0]
sign = i[1]
tag_number = modes[mode]['tag_num_s']
count = tag_number*mult_fact
if mode == 205:
if sign == 1:
count = 29972 # 30000
if sign == -1:
count = 35969 # 36000
if 'noFSR' in prefix:
mode = i[0]
sign = i[1]
logfile = tools.set_file('log', 's', mode, 's', sign, prefix,
extbase=evtlogbase)
tab = DHadTable(logfile)
FSR = tab.cell_get('FSR', 'Value')
count = count - int(FSR)
return count
开发者ID:xshi,项目名称:dhad,代码行数:30,代码来源:sigeffs.py
示例5: get_generated_numbers_double
def get_generated_numbers_double(pair, prefix=''):
if '281ipb' in prefix:
mult_fact = 10
elif '537ipb' in prefix:
mult_fact = 20
elif '818ipb' in prefix or 'v13' in prefix:
mult_fact = 30
else:
raise NameError(prefix)
i = pair[0]
j = pair[1]
#genpath = attr.genpath
#print genpath
#sys.exit()
#if attr.analysis == '10.1' and '281ipbv0' in prefix :
# genpath = '/nfs/cor/user/ponyisi/cleog/scripts-summerconf/'
tag_number = 2000
count = tag_number * mult_fact
if 'v13' in prefix:
fname = modes[i]['fname']
fnamebar = modes[j]['fnamebar']
modename = 'Double_%s__%s' %(fname, fnamebar)
if modename == 'Double_Dp_to_KKpi__Dm_to_KKpi':
count = 47966
if modename == 'Double_Dp_to_KKpi__Dm_to_Kpipipi0':
count = 58403
if modename == 'Double_Dp_to_KKpi__Dm_to_Kpipi':
count = 57954
if modename == 'Double_Dp_to_KKpi__Dm_to_Kspipi0':
count = 57969
if modename == 'Double_Dp_to_KKpi__Dm_to_Kspipipi':
count = 24693
if modename == 'Double_Dp_to_KKpi__Dm_to_Kspi':
count = 57953
if modename == 'Double_Dp_to_Kpipi__Dm_to_KKpi':
count = 59952
if modename == 'Double_Dp_to_Kpipipi0__Dm_to_KKpi':
count = 55955
if modename == 'Double_Dp_to_Kspi__Dm_to_KKpi':
count = 57954
if modename == 'Double_Dp_to_Kspipi0__Dm_to_KKpi':
count = 57956
if modename == 'Double_Dp_to_Kspipipi__Dm_to_KKpi':
count = 57954
if 'noFSR' in prefix:
logfile = tools.set_file('log', 's', pair, 'd', prefix=prefix,
extbase=evtlogbase)
tab =DHadTable(logfile)
FSR = tab.cell_get('FSR', 'Value')
count = count - int(FSR)
return count
开发者ID:xshi,项目名称:dhad,代码行数:56,代码来源:sigeffs.py
示例6: get_fsr_sys
def get_fsr_sys(label):
if label == '281ipbv12.0':
tabfile = os.path.join(attr.tabpath, '281ipbv0', 'FSR_syst.txt')
tab = DHadTable(tabfile)
print 'Loading %s ...' % tabfile
fsr_sys = tab.column_get('diff X 30%')
else:
tab = get_mode_dependent_syst_tab(label)
fsr_sys = tab.row_get('FSR')
return fsr_sys
开发者ID:xshi,项目名称:dhad,代码行数:10,代码来源:syserr.py
示例7: para_md
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)
开发者ID:xshi,项目名称:dhad,代码行数:27,代码来源:compare.py
示例8: diff
def diff(args):
label= None
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 == 'label':
label = value
if label:
labels = label.split(',')
label_A = labels[0]
label_B = labels[1]
tab_A = 'compare_%s.txt' % args[0]
tab_B = 'compare_%s.txt' % args[1]
tabfile_A = os.path.join(attr.tabpath, tab_A)
tabfile_B = os.path.join(attr.tabpath, tab_B)
tab = DHadTable()
tab.column_append_from_tab_file('Mode', tabfile_A, 'Mode')
tab.column_append_from_tab_file(label_A, tabfile_A, 'diff(%)')
tab.column_append_from_tab_file(label_B, tabfile_B, 'diff(%)')
tab.column_append_by_diff('diff', label_B,label_A)
tab.output(_tabname)
开发者ID:xshi,项目名称:dhad,代码行数:29,代码来源:compare.py
示例9: ratios_signal
def ratios_signal(args):
if args[0] == '537ipb/281ipb' and args[1] == '537ipbv2/281ipb':
tabfilename1 = 'compare_yields_signal_divide_537ipb_9.03_regular12.txt'
title1 = args[0]
headname1 = title1
tabfilename2 = 'compare_yields_signal_divide_537ipbv2_9.03_regular12.txt'
title2 = args[1]
headname2 = title2
else:
raise NameError(args)
tabfile1 = os.path.join(attr.tabpath, tabfilename1)
tabfile2 = os.path.join(attr.tabpath, tabfilename2)
if opts.set and opts.set == 'info':
print 'here'
tab = DHadTable()
tab.column_append_from_tab_file('Mode', tabfile1, 'Mode')
tab.column_append_from_tab_file(title1, tabfile1, headname1)
tab.column_append_from_tab_file(title2, tabfile2, headname2)
tab.column_append_by_diff_sigma_pct('diff(%)', title2, title1)
tab.output(_tabname)
开发者ID:xshi,项目名称:dhad,代码行数:26,代码来源:compare.py
示例10: get_signal_shape_sys
def get_signal_shape_sys(label):
if label == '281ipbv12.0':
tabfile = os.path.join(attr.tabpath, '281ipbv0',
'signal_line_shape_syst.txt')
print 'Loading %s ...' % tabfile
tab = DHadTable(tabfile)
line_shape_sys = tab.column_get('Total(%)')
else:
tab = get_mode_dependent_syst_tab(label)
line_shape_sys = tab.row_get('Signal shape')
return line_shape_sys
开发者ID:xshi,项目名称:dhad,代码行数:12,代码来源:syserr.py
示例11: bkg_cont_single_mode
def bkg_cont_single_mode(datatype, mode, label, debug):
prefix = 'dir_'+label
bkgname = '%s_%s.txt' %(datatype, mode)
bkgname = bkgname.replace('/', '_')
bkgfile = tools.set_file(
extbase=attr.bkgpath(), prefix=prefix, comname=bkgname)
if debug:
sys.stdout.write('\ndebug: bkgfile %s\n' %bkgfile)
modename = mode.replace('Single_', '')
result = [modename]
tab = DHadTable(bkgfile)
result.extend(tab.column_get('Number')[1:])
return result
开发者ID:xshi,项目名称:dhad,代码行数:13,代码来源:backgrounds.py
示例12: events
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,代码行数:34,代码来源:compare.py
示例13: get_argus_paras_single
def get_argus_paras_single(label, dt_type, tag, mode):
if 'argus' in label:
prefix = 'dir_' + label.replace('argus', 'desideband')
argus_para_base = attr.fitpath
tabfile = tools.set_file('txt', dt_type, mode, tag,
prefix=prefix,
extbase=argus_para_base)
sys.stdout.write('Loading ARGUS parameters from %s ...\n' %tabfile)
tab = DHadTable(tabfile)
xi = float(tab.cell_get('xi', 'Value'))
p = float(tab.cell_get('p', 'Value'))
return xi, p
开发者ID:xshi,项目名称:dhad,代码行数:15,代码来源:__init__.py
示例14: bkg_ddbar_single_mode
def bkg_ddbar_single_mode(datatype, mode, label, ranges, debug):
prefix = 'dir_'+label
bkgname = '%s_%s.txt' %(datatype, mode)
bkgname = bkgname.replace('/', '_')
bkgfile = tools.set_file(
extbase=attr.bkgpath(), prefix=prefix, comname=bkgname)
if debug:
sys.stdout.write('\ndebug: bkgfile %s\n' %bkgfile)
modename = mode.replace('Single_', '')
bkgtable = get_bkg_tab_link(datatype, mode, label)
result = [modename, bkgtable]
tab = DHadTable(bkgfile)
result.extend(tab.column_analyze('Number', ranges))
return result
开发者ID:xshi,项目名称:dhad,代码行数:15,代码来源:backgrounds.py
示例15: create_fig_mode
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,代码行数:47,代码来源:__init__.py
示例16: bkg_names
def bkg_names(opts, args):
debug_ = opts.debug
test_ = opts.test
set_ = opts.set
prefix = None
if args[0] == 'peak':
prefix = 'peak'
args = args[1:]
parsed = yld.parse_args(args)
datatype = parsed[0]
tag = parsed[1]
modes = parsed[2]
label = parsed[3]
limit = None
if set_ != None and 'min' in set_:
min_ = set_.split('=')[1]
limit = '>%s' %min_
bkgmodes = 20
if set_ != None and 'bkgmodes' in set_:
bkgmodes = int(set_.split('=')[1])
for mode in modes:
tabname = 'bkg_names_%s_%s_%s' %(
datatype, mode, label)
if prefix != None:
tabname = 'bkg_names_%s_%s_%s_%s' %(
prefix, datatype, mode, label)
tabname = tabname.replace('/', '_')
tab = DHadTable()
modename = get_orgname_from_fname(mode)
bkg_names, bkg_numbers = bkg_names_single_mode(
datatype, mode, label, limit, bkgmodes, debug_, prefix)
tab.column_append(bkg_names, title='Backgrounds for %s' %modename)
tab.column_append(bkg_numbers, title='Number of Events')
tab.sort_by_column('Number of Events', reverse=True)
orgfooter = ': '+sys.argv[0].split('/')[-1]+\
' tab backgrounds names %s %s %s ' %(
datatype, mode, label)
if prefix != None:
orgfooter = ': '+sys.argv[0].split('/')[-1]+\
' tab backgrounds names %s %s %s %s ' %(
prefix, datatype, mode, label)
tab.output(tabname, orgfooter=orgfooter, test=test_)
开发者ID:xshi,项目名称:dhad,代码行数:50,代码来源:backgrounds.py
示例17: files
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,代码行数:26,代码来源:compare.py
示例18: init_paras_single
def init_paras_single(label, dt_type, tag, mode):
if '281ipb' in label:
init_para_prefix = 'dir_281ipbv12'
elif '537ipb' in label:
init_para_prefix = 'dir_537ipbv12'
elif '818ipb' in label or 'v13' in label:
init_para_prefix = 'dir_818ipbv12'
else:
raise ValueError(label)
init_para_base = attr.fitpath
if dt_type == 'generic':
if label in ['281ipbv7', '537ipbv7', '818ipbv7']:
dt_type = 'signal'
tabfile = tools.set_file('txt', dt_type, mode, tag,
prefix=init_para_prefix,
extbase=init_para_base)
sys.stdout.write('Loading init paras from %s ... \n' %tabfile)
tab = DHadTable(tabfile)
N1 = float(tab.cell_get('N1', 'Value'))
N2 = float(tab.cell_get('N2', 'Value'))
Nbkgd1 = float(tab.cell_get('Nbkgd1', 'Value'))
Nbkgd2 = float(tab.cell_get('Nbkgd2', 'Value'))
md = float(tab.cell_get('md', 'Value'))
p = float(tab.cell_get('p', 'Value'))
sigmap1 = float(tab.cell_get('sigmap1', 'Value'))
xi = float(tab.cell_get('xi', 'Value'))
return N1, N2, Nbkgd1, Nbkgd2, md, p, sigmap1, xi
开发者ID:xshi,项目名称:dhad,代码行数:35,代码来源:__init__.py
示例19: events
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,代码行数:27,代码来源:parse.py
示例20: get_dcsd_sys
def get_dcsd_sys(label, i, j):
if label in ['818ipbv7']:
sys_err = attr.sys_err(label)
dcsd_sys = float(sys_err['Double DCSD interference(Neutral DT)'])
dcsd_cor = None
elif label in ['818ipbv8', '818ipbv9', '818ipbv10']:
tabdir = '818ipbv7'
tabfile = os.path.join(attr.cbxtabpath, tabdir,
'dcsd_correction.txt')
tab = DHadTable(tabfile)
modename = '%s %s' %(modes[i]['fname'], modes[j]['fnamebar'])
dcsd_val_err = tab.cell_get(modename, 'Yield correction factor')
dcsd_cor = float(dcsd_val_err.split('+/-')[0])
dcsd_sys = float(dcsd_val_err.split('+/-')[1])
else:
raise NameError(lable)
return dcsd_sys, dcsd_cor
开发者ID:xshi,项目名称:dhad,代码行数:18,代码来源:genericyields.py
注:本文中的tools.DHadTable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论