Ejemplo n.º 1
0
print
a2 = PQU("2.300000000000(1) MeV")
print a2
print a2.info(significantDigits=15)
a2 = PQU("2.300000000001(1) MeV")
print a2
print a2.info(significantDigits=15)

print
a2 = PQU("2.300000000003(1)", "MeV")
print a2
print a2.info(significantDigits=15)

print
l = PQU(10., 'm')
big_l = PQU(10., 'km')
sum_l = big_l + l
print sum_l
print l.info(significantDigits=15)
print big_l.info(significantDigits=15)
print sum_l.info(significantDigits=15)

print
E = PQU(1000, 'MeV/c**2')  # This is similar to the prior one.
print E
print E.info(significantDigits=15)
kg = E.inUnitsOf('kg')
print kg
print kg.info(significantDigits=15)
Ejemplo n.º 2
0
Archivo: t12.py Proyecto: icmeyer/fudge
# 1. This notice is required to be provided under our contract with the U.S.
# Department of Energy (DOE). This work was produced at Lawrence Livermore
# National Laboratory under Contract No. DE-AC52-07NA27344 with the DOE.
#
# 2. Neither the United States Government nor Lawrence Livermore National Security,
# LLC nor any of their employees, makes any warranty, express or implied, or assumes
# any liability or responsibility for the accuracy, completeness, or usefulness of any
# information, apparatus, product, or process disclosed, or represents that its use
# would not infringe privately-owned rights.
#
# 3. Also, reference herein to any specific commercial products, process, or services
# by trade name, trademark, manufacturer or otherwise does not necessarily constitute
# or imply its endorsement, recommendation, or favoring by the United States Government
# or Lawrence Livermore National Security, LLC. The views and opinions of authors expressed
# herein do not necessarily state or reflect those of the United States Government or
# Lawrence Livermore National Security, LLC, and shall not be used for advertising or
# product endorsement purposes.
#
# <<END-copyright>>

import sys
sys.path.insert(0, '../../')

from pqu.PQU import PQU

t = PQU("314159.", 's')
print t.info(significantDigits=15)
s = t.inUnitsOf('d', 'h', 'min', 's')
for i in s:
    print '\n', i, '\n', i.info(significantDigits=15)