diff --git a/README.rst b/README.rst index 335fb87..b163c47 100644 --- a/README.rst +++ b/README.rst @@ -55,6 +55,9 @@ It is largely based on the international system of units (`SI`_) but augments it with handy definitions, changing the basic length and time units. +Note that many units are now *exact*, such as the speed of light in vacuum. +The package is in agreement with the values in the 2020 Particle Data Group review. + .. _CLHEP: http://proj-clhep.web.cern.ch/proj-clhep/ .. _SI: http://www.physics.nist.gov/cuu/Units/index.html diff --git a/src/hepunits/constants/constants.py b/src/hepunits/constants/constants.py index 5c7ccdf..79a94d4 100644 --- a/src/hepunits/constants/constants.py +++ b/src/hepunits/constants/constants.py @@ -29,7 +29,7 @@ # Physical constants # ----------------------------------------------------------------------------- -# Speed of light in vacuum +# Speed of light in vacuum (exact value, taken from PDG 2020) c_light = 299792458 * m / s c_light_sq = c_light * c_light @@ -37,12 +37,15 @@ eminus = -eplus # electron charge e_sq = eplus * eplus -# Avogadro constant (taken from CODATA) -Avogadro = 6.022140857e23 / mole +# Avogadro constant (exact value, taken from PDG 2020) +Avogadro = 6.02214076e23 / mole + +# Planck constant (exact value, taken from PDG 2020) +h_Planck = 6.62607015e-34 * joule * s -# Planck constant (taken from CODATA) -h_Planck = 6.626070040e-34 * joule * s hbar_Planck = h_Planck / two_pi hbar = hbar_Planck + hbarc = hbar_Planck * c_light + hbarc_sq = hbarc * hbarc diff --git a/src/hepunits/units/units.py b/src/hepunits/units/units.py index 6bb7e33..88b7477 100644 --- a/src/hepunits/units/units.py +++ b/src/hepunits/units/units.py @@ -126,12 +126,14 @@ attobarn = _pre.atto * barn mb = millibarn +ub = microbarn nb = nanobarn pb = picobarn fb = femtobarn ab = attobarn invmb = 1.0 / millibarn +invub = 1.0 / microbarn invnb = 1.0 / nanobarn invpb = 1.0 / picobarn invfb = 1.0 / femtobarn @@ -155,6 +157,7 @@ s = second ms = millisecond +us = microsecond ps = picosecond fs = femtosecond # shortcut "as = attosecond" not possible since "as" is a reserved word ;-) @@ -250,7 +253,8 @@ # -------------------------------------------------------------------- # Positron charge [Coulomb] -e_SI = 1.6021766208e-19 # taken from CODATA +e_SI = 1.602176634e-19 # exact value, taken from PDG 2020 + # Electric charge [Q] # -------------------------------------------------------------------- @@ -268,7 +272,7 @@ # Energy [E] # ---------- -joule = electronvolt / e_SI # joule = 6.24150 e+12 * MeV +joule = electronvolt / e_SI # joule = 6.24151e+12 * MeV J = joule @@ -350,17 +354,43 @@ # Activity [T^-1] becquerel = 1.0 / second +kilobecquerel = _pre.kilo * becquerel +megabecquerel = _pre.mega * becquerel +gigabecquerel = _pre.giga * becquerel + Bq = becquerel +kBq = kilobecquerel +MBq = megabecquerel +GBq = gigabecquerel + curie = 3.7e10 * becquerel +millicurie = _pre.milli * curie +microcurie = _pre.micro * curie +nanocurie = _pre.nano * curie + Ci = curie +mCi = millicurie +uCi = microcurie +nCi = nanocurie + # Absorbed dose [L^2][T^-2] gray = joule / kilogram +megagray = _pre.mega * gray +kilogray = _pre.kilo * gray +milligray = _pre.milli * gray +microgray = _pre.micro * gray + Gy = gray +MGy = megagray +kGy = kilogray +mGy = milligray +uGy = microgray + # Dose equivalent sievert = joule / kilogram diff --git a/tests/constants/test_constants.py b/tests/constants/test_constants.py index 1285763..9b78310 100644 --- a/tests/constants/test_constants.py +++ b/tests/constants/test_constants.py @@ -13,7 +13,7 @@ def test_constants(): assert pi_sq == two_pi * half_pi - assert Avogadro == 6.022140857e23 + assert Avogadro == 6.02214076e23 assert c_light / (m / s) == 299792458 assert hbarc_sq / c_light_sq == approx((h_Planck / two_pi) ** 2) assert hbar / (eV * s) == hbar / 1.0e3