hep系统中的单位和常数

hepunits的Python项目详细描述


Build StatusCoverageTests

hepunits收集 从最初由CLHEP项目定义的基本单位派生的hep单位制, 它们是not与国际单位制相同:

QuantityNameUnit
Lengthmillimetermm
Timenanosecondns
EnergyMega electron VoltMeV
Positron chargeeplus
TemperaturekelvinK
Amount of substancemolemol
Luminous intensitycandelacd
Plane angleradianrad
Solid anglesteradiansr

它主要基于国际单位制(SI

QuantityNameUnit
Lengthmeterm
Timeseconds
Masskilogramkg
Electric currentampereA
TemperaturekelvinK
Amount of substancemolemol
Luminous intensitycandelacd

但它增加了方便的定义,改变了基本的长度和时间单位。

安装

像任何其他python包一样安装hepunits

pip install hepunits

或者类似的(如果愿意,可以使用--uservirtualenv等)。

开始

模块hepunits.constants包含两种常量: 物理常数和常用常数。

典型用法如下:

>>>fromhepunits.constantsimportc_light>>>fromhepunits.unitsimportpicosecond,micrometer>>>tau_Bs=1.5*picosecond# a particle lifetime, say the Bs meson's>>>ctau_Bs=c_light*tau_Bs# ctau of the particle, ~450 microns>>>printctau_Bs# result in HEP units, so mm0.449688687>>>printctau_Bs/micrometer# result in micrometers449.688687

hepunits.units模块的典型用法:

>>># add two quantities with length units and get the result in meters>>>fromhepunitsimportunitsasu>>>(1*u.meter+5*u.cm)/u.meter1.05>>># the default result is, of course, in HEP units, so mm>>>1*u.meter+5*u.cm1050.0
>>>fromhepunits.unitsimportMeV,GeV>>>massWindow=100*MeV# define a 100 MeV mass window>>>defenergy_resolution():...# returns the energy resolution of 100 MeV...return100*MeV...>>>energy_resolution()/GeV# get the energy resolution in GeV0.1

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

推荐PyPI第三方库


热门话题
ArrayList Java中的搜索字符串   另一个web应用程序的java访问会话   另一个应用程序中的活动和服务之间的java通信   java根据Json字符串类型将Json字符串转换为对象   eclipse如何解决java中的错误异常。lang.NoSuchMethodError:'java。字符串javax。摆动JOptionPane。showInputDialog(java.lang.String)'   线程“main”java中的安卓异常。lang.NoClassDefFoundError:org/codehaus/jackson/JsonParseException   java如何在安卓 emulator上显示Mat图像?使用NDK   Java在本地读取测试源文件,但在服务器上读取失败   java dowhile循环用于计算输入数字中的数字。故障排除代码   JAva初学者在编写获取成本的方法时遇到困难   java是shell游戏。我如何让物体移动,特别是在特定的曲线上,但顺序是随机的?   java如何区分两个同名的JButton   java为什么我在Spring Boot中需要一个接口?   java将文件路径插入数据库将删除\   使用InterfaceType初始化java对象   java如何部署一个分为Angular、Spring Boot和MySQL的项目?   java如何使用Symja解决不等式?