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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在java中将字符串转换为音频输入   java如何使用Spring Boot RestTemplate解组json列表   计算机上C++ OpenCV项目转换为OpenCV Android的java步骤   Java Spring Telegraf数据表不工作   openurlconnection与connect之间的java差异?   java Solr字段搜索、通配符和转义字符   java如何使用DLFolderLocalServiceUtil类的getFolders()方法?   尝试用Java编写文件   java连续双缓冲解决方案不起作用   两个数组的Java乘积   java Jackson,如何正确编写自定义反序列化程序   java将布尔标志按一定顺序排列以获得更好的性能是否有意义   java Vaadin无缓冲网格无法关闭   java在MySQL中以同一用户身份同时从不同客户端登录安全吗?   java如何使用安卓asynchttp库   java无法在Android中使用AlarmManager停止服务   java在Hibernate的XML配置文件中指定默认值   Spring启动应用程序中的java内存SQLITE不工作   Java代码无法写入文本文件,