pythonic访问高能粒子数据表和pdg id代码。
PyPDT的Python项目详细描述
pythonic访问高能粒子数据表和id代码。
这是python中对用于访问的常用heppdt/heppid包的重新思考 粒子数据表和pdg方案粒子id代码。0.7.0版以后的版本应该是 与Python3兼容。
粒子数据表函数(cf.heppdt)
heppdt没有本机python接口,这并不容易 为Python自然地封装它的C++接口,所以PyPDT是从头开始写的。 在python中,类数比原来的要少:这只是一种方便 接口到一个小的ascii数据文件,那么谁需要大量的类呢?
示例:
>>> import pypdt >>> pypdt.get(2212) # print out proton particle data >>> p = pypdt.get(2112) # get the neutron particle data object >>> tbl = pypdt.ParticleDataTable() # make a particle data table >>> # or tbl = pypdt.ParticleDataTable() # to read from AFS default db >>> # or tbl = pypdt.PDT() # if you prefer minimal keystrokes to clarity :) >>> print tbl[13] # print a summary of muon information >>> tbl[6].mass # access the top mass in GeV >>> tbl[23].width # access the Z width in GeV >>> tbl[310].lifetime # access the K0S lifetime in ps >>> tbl[310].ctau # access the K0S lifetime in mm >>> tbl[310].mean_disp(10.) # get the mean flight distance of a 10 GeV K0S in mm >>> for p in tbl: print p # print summaries for all known particles >>> # print info for all particles in asc lifetime order: >>> for t, p in sorted((p.ctau, p) for p in tbl): print p
世界是你的选择。
为了方便起见,您甚至可以从命令行使用PYPDT:
$ python -m pypdt 13 310 mu^-: ID=13, m=1.06e-01 GeV, 3*q=-3, width=9.99e-19 GeV, tau=6.59e+05 ps, ctau=1.97e+05 mm K_S^0: ID=310, m=4.98e-01 GeV, 3*q=0, width=2.46e-14 GeV, tau=2.68e+01 ps, ctau=8.02e+00 mm
粒子id函数(参见heppid)
pypdt还包含用于 解释pdg方案中的粒子id码。这些函数的代码 已经从heppid的particleidmethods直接翻译成python–请 如果出现以下错误或演变,请通知此包的作者: PID方案。
示例:
>>> pypdt.isSUSY(2010011) True
- 待办事项:
- 使用doctest