In [1]:
%pylab inline
The Astro Pi measures presures in milibar
For $h$ in m \begin{align} p\ \text{Pa}=&101325(1. - 2.25577\times 10^{-5} h )^{5.25588}\\ \frac{1}{100} p\ \text{milibar}=&101325(1. - 2.25577\times 10^{-5} h )^{5.25588} \end{align} For example, if $h=10000$ m:
In [85]:
def htop(h,units='milibar'):
'''h in m
returns p in Pa'''
k=1
if units=='Pa':
k=1
if units=='mmhg':
k=7.50061683/1000.
if units=='milibar':
k=1./100.
return 101325*k* (1. - 2.25577E-5* h)**5.25588
def ptoh(p,units='milibar'):
'''p in m
returns height in m above the sea level'''
return 44330.76*( 1-(100*p/101325)**(0.1902631) )
In [87]:
import numpy as np
import pandas as pd
ap=pd.DataFrame()
ap['p']=np.loadtxt('p.txt')
ap['h']=ptoh(ap.p)
In [88]:
plt.plot(ap.index,ap.h,'r-',lw=2)
plt.xlabel('Tiempo transcurrido (s)',size=20)
plt.ylabel('Altura del edificio (m)',size=20)
Out[88]:
In [89]:
plt.plot(ap.index,ap.h-ap.h.min(),'r-',lw=2)
plt.title('La Altura Entrebosques del S3 al 26 es %g m' %round( (ap.h.max()-ap.h.min()),1 ))
plt.xlabel('Tiempo transcurrido (s)',size=20)
plt.ylabel('Altura del edificio (m)',size=20)
Out[89]:
In [90]:
ap.p.min()
Out[90]:
In [91]:
ptoh(ap.p.min())
Out[91]:
In [94]:
print('floor')
raw_input()
print('head')
raw_input()
print('height')
In [ ]: