Esempio n. 1
0
File: t19.py Progetto: icmeyer/fudge
def f(s, unc=None):

    print
    print s
    print unc
    a = PQU(s, uncertainty=unc)
    print a
    print a.info(significantDigits=15)
    a.truncate(True, True)
    print a
    print a.info(significantDigits=15)
Esempio n. 2
0
def f(s):

    print
    print '-------------'
    a = parsers.parsePQUString(s)
    print s
    v = PQU(a[0], a[1], a[2])
    print v
    print v.info(significantDigits=15)
    print
    p = 3.2 * v
    print p
    print p.info(significantDigits=15)

    print
    p = v * "3.2 MeV"
    print p
    print p.info(significantDigits=15)

    print
    p = v * "3.2%"
    print p
    print p.info(significantDigits=15)
Esempio n. 3
0
File: t17.py Progetto: icmeyer/fudge
def changeUnc( s ) :

    print '============'
    b = PQU( s )
    print b
    print b.info( significantDigits = 15 )
    print
    b.changeUncertaintyStyle( pqu_uncertainty.pqu_uncertaintyStyleParenthesis )
    print b
    print b.info( significantDigits = 15 )
    print
    b.changeUncertaintyStyle( pqu_uncertainty.pqu_uncertaintyStylePlusMinus )
    print b
    print b.info( significantDigits = 15 )
Esempio n. 4
0
def changeUnc( s ) :

    print '============'
    b = PQU( s )
    print b
    print b.info( significantDigits = 15 )
    print
    b.changeUncertaintyPercent( not( b.uncertainty.isPercent( ) ) )
    print b
    print b.info( significantDigits = 15 )
    print
    b.changeUncertaintyPercent( not( b.uncertainty.isPercent( ) ) )
    print b
    print b.info( significantDigits = 15 )
Esempio n. 5
0
print f1 != 1.23456e10
print f1 <= 1.23456e10
print f1 < 1.23456e10
print f1 >= 1.23456e10
print f1 > 1.23456e10

print
p1 = PQU('0.0 +/- 0.05 Ang')
p2 = PQU('  0.135    +/- 1.2% eV/mm  ')
p3 = PQU('  11.e4 ')
p4 = PQU('13.5 +/- 3.2% eV/mm  ')
p5 = PQU('12.1 +/- 12.21% eV/mm  ')
p6 = PQU('12.1 +/- 1.2% eV/mm  ')

print p1
print p1.info(significantDigits=15)
print p2
print p2.info(significantDigits=15)
print p3
print p3.info(significantDigits=15)
print p4
print p4.info(significantDigits=15)
print p5
print p5.info(significantDigits=15)
print p6
print p6.info(significantDigits=15)


def operator(oper, p1, p2):
    def operator2(oper, p1, p2):
Esempio n. 6
0
# 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

a = PQU('10.0(2) m')
b = PQU('22.0(3) m')
r = b / a
print
print a
print a.info(significantDigits=15)
print
print b
print b.info(significantDigits=15)
print
print r
print r.info(significantDigits=15)
Esempio n. 7
0
# 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

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)
Esempio n. 8
0
File: t16.py Progetto: icmeyer/fudge
# 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

c = PQU("0.0000 +/- 3e-4")
print
print c
print c.info(significantDigits=15)

c = PQU("0.0000(3)")
print
print c
print c.info(significantDigits=15)