Units (skhep.units) — Scikit-HEP 0.0.1 documentation

# Units (skhep.units)

Subpackage for the HEP System of Units, (derived) physical units and commonly-used unit prefixes.

The HEP System of Units is the set of basic units originally defined by the CLHEP project.

## Common unit prefixes

There are 2 types of prefixes:

> - SI prefixes [SI_prefixes].
> - Binary prefixes [Binary_prefixes].

References

[SI_prefixes] | https://en.wikipedia.org/wiki/International_System_of_Units#Prefixes.

[Binary_prefixes] | https://en.wikipedia.org/wiki/Unit_prefix#Binary_prefixes.

## Module of HEP basic units

In HEP the System of Units consists of the basic units originally defined by the [CLHEP] project:

> Quantity | Name | Unit
> --- | --- | ---
> Length | millimeter | mm
> Time | nanosecond | ns
> Energy | Mega electron Volt | MeV
> Positron charge | eplus |
> Temperature | kelvin | K
> Amount of substance | mole | mol
> Luminous intensity | candela | cd
> Plane angle | radian | rad
> Solid angle | steradian | sr

It is largely based on the international system of units ([SI])

> Quantity | Name | Unit
> --- | --- | ---
> Length | meter | m
> Time | second | s
> Mass | kilogram | kg
> Electric current | ampere | A
> Temperature | kelvin | K
> Amount of substance | mole | mol
> Luminous intensity | candela | cd

but augments it with handy definitions, changing the basic length and time units.

This module also defines an extensive set of derived units.

Typical use cases:

    >>> # add two quantities with length units and get the result im meters
    >>> from skhep import units as u
    >>> (1 * u.meter + 5 * u.cm) / u.meter
    1.05
    >>> from skhep.units import MeV, GeV
    >>> massWindow = 100 * MeV    # define a 100 MeV mass window
    >>> def energy_resolution():
    ...    # returns the energy resolution of 100 MeV
    ...    return 100 * MeV
    ...
    >>> energy_resolution() / GeV # get the energy resolution in GeV
    0.1

References

[CLHEP] | http://proj-clhep.web.cern.ch/proj-clhep/.

[SI] | http://www.physics.nist.gov/cuu/Units/index.html.