T. Martz-Oberlander, 2015-11-12, CO2 and Speed of Sound

Calculated pitch from CO2 levels

Here I use Cramer's equation for frequency of sound from CO2 concentration (1992).

freq = a0 + a1(T) + ... + (a9 +a10 +a11(T^2)) +... + a14(xc^2) where xc is the mole fraction of CO2


In [8]:
#Make function from Cramer equation for all CO2 values in 'env' dataframe
import pandas as pd
env = pd.read_table('../Data/CO2May.csv', sep =',')


#define coefficients (Cramer, 1992)
a0 = 331.5024
a1 = 0.603055
a2 = -0.000528
a9 = -85.20931
a10 = -0.228525
a14 = 29.179762
xc = 0.000314

for T in temp:

    def cramer(CO2):
        '''Calculate pitch from CO2 concentration'''
        calc_freq = (a0 + a1(T) + (a9 + a10 + a11(T**2)) + a14(xc**2))


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-8-1a8436c87500> in <module>()
     13 xc = 0.000314
     14 
---> 15 for T in temp:
     16 
     17     def cramer(CO2):

NameError: name 'temp' is not defined

In [ ]: