Rgas = 8.314e7 # erg/K/mol
Av = 6.022e23 # avagadro's number
mp= 1.67e-24 # hydrogen molec
# Name, ty, dist, M, R, Period, Temp, mu (H2=2, He = 4), cp
data = []
data.append(["HD 209458 b", "hot-J",0.047*AU, 0.68*MJ, 1.36*RJ, 3.525*day, 0, 0,0])
data.append(["Positiveuncertainty", "uncertainty",0.00045*AU, 0.014*MJ, 0.016*RJ, 0, 0, 0,0])
data.append(["Negativeuncertainty", "uncertainty",0.00047*AU, 0.015*MJ, 0.019*RJ, 0, 1450, 2.3,1.59e4*cp2cgs])
data.append(["Kepler-7b", "hot-J",0.063*AU, 0.45*MJ,1.57*RJ, 4.89*day, 1630, 2.3,1.63e4*cp2cgs])
data.append(["Positiveuncertainty", "uncertainty",0.0012*AU, 0.051*MJ,0.0749*RJ, 0, 10, 0,0])
data.append(["Negativeuncertainty", "uncertainty",0.0013*AU, 0.048*MJ,0.0708*RJ, 0, 10, 0,0])
for d in data:
nm,ty,asemi,M,a,P,T,mu,cp = d
Om = 2*np.pi/P
g = G*M/a**2 # surface accel
Rspec = Rgas/(Av*mu*mp) #/(mu*mp)
#cp = 7/2*(Rgas/(Av*28.97*mp)); print(cp/1e4); quit()
H = Rspec*T/g
if ty == 'uncertainty':
H =
The code is not full, it is just including the part I have a problem with.
I want to put uncertainty values separated from the data row.
However, since the H formula includes division, I would need to define the relative uncertainty, which should be the absolute uncertainty over the data value itself. Thus, to get relative uncertainty, I have to obtain the data value from the upper row. How can I do this?