Skip to content

Commit

Permalink
Better documentation via help(...) (#48)
Browse files Browse the repository at this point in the history
* Better documentation via help(...)

* Minor update
  • Loading branch information
eduardo-rodrigues authored Oct 13, 2021
1 parent 8001f4b commit 94314ed
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 37 deletions.
21 changes: 0 additions & 21 deletions src/hepunits/constants/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license, see LICENSE.
"""
This module `hepunits.constants` contains 2 sorts of constants:
* Physical constants.
* Common and/or handy constants.
All constants are computed in the HEP System of Units
as defined in the `hepunits.units` package.
Typical use case::
>>> from hepunits.constants import c_light
>>> from hepunits.units import picosecond, 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
>>> print ctau_Bs # result in HEP units, so mm ;-)
0.449688687
>>> print ctau_Bs / micrometer # result in micrometers
449.688687
"""

from .constants import *
19 changes: 18 additions & 1 deletion src/hepunits/constants/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,25 @@
Physical and other handy constants
==================================
This module `hepunits.constants` contains 2 sorts of constants:
* Physical constants.
* Common and/or handy constants.
All constants are computed in the HEP System of Units
as defined in the units module.
as defined in the `hepunits.units` module.
Typical use case::
>>> from hepunits.constants import c_light
>>> from hepunits.units import picosecond, 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
>>> print ctau_Bs # result in HEP units, so mm ;-)
0.449688687
>>> print ctau_Bs / micrometer # result in micrometers
449.688687
"""

# -----------------------------------------------------------------------------
Expand Down
8 changes: 0 additions & 8 deletions src/hepunits/units/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license, see LICENSE.

"""
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.
"""

from .prefixes import *
from .units import *
3 changes: 1 addition & 2 deletions src/hepunits/units/prefixes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license, see LICENSE.
"""
********************
Common unit prefixes
********************
====================
There are 2 types of prefixes:
Expand Down
14 changes: 9 additions & 5 deletions src/hepunits/units/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
# Licensed under a 3-clause BSD style license, see LICENSE.

"""
*************************
Module of HEP basic units
*************************
Units in the HEP system of units
================================
This module `hepunits.units` contains 2 submodules for:
* Basic physical units and derived units (`hepunits.units.units`).
* Commonly-used unit prefixes (`hepunits.units.prefixes`).
All units are provided in the HEP System of Units as defined below.
In HEP the System of Units consists of the basic units originally defined by
the [CLHEP]_ project:
Expand Down Expand Up @@ -40,8 +46,6 @@
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 in meters
Expand Down

0 comments on commit 94314ed

Please sign in to comment.