def f(s, shouldRaise=False): print try: v = PQU(s) except: if (not (shouldRaise)): print s print '========= FAILED =========' return if (shouldRaise): print s print '========= FAILED =========' print v print float(v), v.getUncertaintyValueAs()
# 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) print type(u), u