Example #1
0
a = None
b = 5
c = 5.0
d = [5, 0]
e = ndarray([5, 0])
f = 'coso'
g = uarray(5.5, 0.1)
h = ndarray([3.0])
i = uarray([1, 2], [0.01, 0.002])
j = ufloat(5.5, 0.1)
k = uarray([5.5], [0.1])

logSI_OI = ufloat(-1.53, 0.05)
print logSI_OI
SI_OI = uma_pow(10, logSI_OI)
print SI_OI
OI_SI = 1 / SI_OI
print OI_SI
OI_SI2 = uma_pow(10, -logSI_OI)
print OI_SI2

# print unum_log10(j), type(unum_log10(j))
# print umath_log10(j), type(umath_log10(j))
# print math_log10(j), type(math_log10(j))
# print num_log10(j), 'este no fona'

# print j.nominal_value, nominal_values(j), type(j.nominal_value), type(nominal_values(j))
# print j.std_dev, std_devs(j),type(j.std_dev), type(std_devs(j))
#
# print 'g', isinstance(g, (Sequence, np.ndarray))
a = None
b = 5
c = 5.0
d = [5,0]
e = ndarray([5,0])
f = 'coso'
g = uarray(5.5, 0.1)
h = ndarray([3.0])
i = uarray([1, 2], [0.01, 0.002])
j = ufloat(5.5, 0.1)
k = uarray([5.5], [0.1])

logSI_OI = ufloat(-1.53, 0.05)
print logSI_OI
SI_OI = uma_pow(10, logSI_OI)
print SI_OI
OI_SI = 1 / SI_OI
print OI_SI
OI_SI2 = uma_pow(10, -logSI_OI)
print OI_SI2

# print unum_log10(j), type(unum_log10(j))
# print umath_log10(j), type(umath_log10(j))
# print math_log10(j), type(math_log10(j))
# print num_log10(j), 'este no fona'




Example #3
0
from uncertainties                      import ufloat
from uncertainties.umath                import pow as uma_pow

#Sulfur O/H ratio
logSI_OI_Gradient = ufloat(-1.53, 0.05)                
OI_SI = uma_pow(10, -logSI_OI_Gradient)

HeII_HI = ufloat(0.105926246317, 1.38777878078e-17)

OI_HI  = ufloat(0.000129583794561, 1.354535563e-06)

SI_HI = ufloat(3.58051262182e-06, 8.61374827027e-08)

HeIII_HeII = ufloat(0.000577309209945, 7.63955464343e-05)

HeI_HI = HeII_HI + HeIII_HeII

print 'HeI_HI', HeI_HI
Y_mass_InferenceO = (4 * HeI_HI * (1 - 20 * OI_HI)) / (1 + 4 * HeI_HI)
Y_mass_InferenceS = (4 * HeI_HI * (1 - 20 * OI_SI * SI_HI)) / (1 + 4 * HeI_HI)

print 'este radio', OI_SI.nominal_value
print OI_SI.nominal_value * 3.58051262182e-06, 'comparado con', 0.000129583794561

print 'Via single lines'
print (4 * 0.109697250692 * (1 - 20 * 0.000129583794561)) / (1 + 4 * 0.109697250692)
print (4 * 0.109697250692 * (1 - 20 * 33.8844156139 * 3.58051262182e-06)) / (1 + 4 * 0.109697250692)

print 'Via inference'
print Y_mass_InferenceO
print Y_mass_InferenceS