print a = PQU(2.3, "MeV") a1 = PQU("2.3 +/- 1e-14 MeV") a2 = PQU("2.30000000000003(1)", "MeV") b = PQU(3e2, "m") c = PQU(1, "J") print 'a = ', a print 'a1 = ', a1 print 'a2 = ', a2 print 'b = ', b print 'c = ', c print c.inBaseUnits() print print a.inBaseUnits() print a.getValueAs('m**2*kg/s**2') print a * b print a a.convertToUnit('J') print a print a * b print a.inBaseUnits() print b.inBaseUnits() print c = PQU(342, "", ".12%") print c print c.info(significantDigits=15) print 100 + c
# 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>> from pqu.PQU import PQU v = PQU('1.234(56) eV') print v u = v.getValueAs('MeV') print type(u), u u = v.getValueAs('MeV', asPQU=True) print type(u), u u = v.getUncertaintyValueAs() print type(u), u u = v.getUncertaintyValueAs('MeV') print type(u), u u = v.getUncertaintyValueAs(asPQU=True) print type(u), u u = v.getUncertaintyValueAs('MeV', asPQU=True)