How to use the hepunits.units.ns function in hepunits

To help you get started, we’ve selected a few hepunits examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scikit-hep / particle / src / particle / particle / kinematics.py View on Github external
4.33e-10
    >>>
    >>> lifetime_to_width(1.520119980246514*ps)   # result again returned in MeV
    4.33e-10
    >>>
    >>> lifetime_to_width(1.520119980246514*ps)/eV   # result converted to eV
    0.000433
    """

    if tau < 0:
        raise ValueError("Input provided, {0} <= 0!".format(tau))
    elif tau == 0:
        return float("inf")

    # Just need to first make sure that the lifetime is in the standard unit ns
    return hbar / float(tau / ns)
github scikit-hep / scikit-hep / skhep / math / kinematics.py View on Github external
Parameters
    -----------
    tau : float > 0
        Particle lifetime, typically in picoseconds (any HEP time unit is OK).

    Returns
    -------
    Particle decay width, in the HEP standard energy unit MeV.
    """

    if tau <= 0:
        raise ValueError( 'Input provided, %s <= 0!'.format(tau) )

    # Just need to first make sure that the lifetime is in the standard unit ns
    return hbar / float(tau / ns)

hepunits

Units and constants in the HEP system of units

BSD-3-Clause
Latest version published 1 month ago

Package Health Score

70 / 100
Full package analysis

Similar packages