Salman Habib's project solution

Sensitivity analysis

We start importing libraries and making the plots look awesome


In [1]:
import matplotlib
matplotlib.use('nbagg')
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib import rc

rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino']})
rc('text', usetex=True)

#LaTeX
plt.rc('text', usetex=True)
plt.rc('font', family='serif')

Planck data


In [2]:
planck = pd.read_table("planck", skiprows=5,header = None, sep=" ")
planck.drop(planck.columns[[2]],axis=1, inplace=True)
planck.columns = ['a', 'b']

Changing $\Omega_b$


In [3]:
df = pd.read_table("omb/output1.txt", skiprows=5,header = None, sep=" ")
df.drop(df.columns[[2]],axis=1, inplace=True)
df1 = pd.read_table("omb/output2.txt", skiprows=5,header = None, sep=" ")
df1.drop(df1.columns[[2]],axis=1, inplace=True)
df2 = pd.read_table("omb/output3.txt", skiprows=5,header = None, sep=" ")
df2.drop(df2.columns[[2]],axis=1, inplace=True)
df3 = pd.read_table("omb/output4.txt", skiprows=5,header = None, sep=" ")
df3.drop(df3.columns[[2]],axis=1, inplace=True)
df4 = pd.read_table("omb/output5.txt", skiprows=5,header = None, sep=" ")
df4.drop(df4.columns[[2]],axis=1, inplace=True)
df5 = pd.read_table("omb/output6.txt", skiprows=5,header = None, sep=" ")
df5.drop(df5.columns[[2]],axis=1, inplace=True)
df6 = pd.read_table("omb/output7.txt", skiprows=5,header = None, sep=" ")
df6.drop(df6.columns[[2]],axis=1, inplace=True)
df7 = pd.read_table("omb/output8.txt", skiprows=5,header = None, sep=" ")
df7.drop(df7.columns[[2]],axis=1, inplace=True)
df8 = pd.read_table("omb/output9.txt", skiprows=5,header = None, sep=" ")
df8.drop(df8.columns[[2]],axis=1, inplace=True)
df9 = pd.read_table("omb/output10.txt", skiprows=5,header = None, sep=" ")
df9.drop(df9.columns[[2]],axis=1, inplace=True)

In [4]:
df.columns = ['a', 'b']
df1.columns = ['a', 'b']
df2.columns = ['a', 'b']
df3.columns = ['a', 'b']
df4.columns = ['a', 'b']
df5.columns = ['a', 'b']
df6.columns = ['a', 'b']
df7.columns = ['a', 'b']
df8.columns = ['a', 'b']
df9.columns = ['a', 'b']

Plot the data using Matplotlib


In [5]:
plt.loglog(df["a"],df["b"],label=r'$\Omega_b=0.0215$')
plt.loglog(df1["a"],df1["b"],label=r'$\Omega_b=0.0220$')
plt.loglog(df2["a"],df2["b"],label=r'$\Omega_b=0.0223$')
plt.loglog(df3["a"],df3["b"],label=r'$\Omega_b=0.0225$')
plt.loglog(df4["a"],df4["b"],label=r'$\Omega_b=0.0227$')
plt.loglog(df5["a"],df5["b"],label=r'$\Omega_b=0.0229$')
plt.loglog(df6["a"],df6["b"],label=r'$\Omega_b=0.0230$')
plt.loglog(df7["a"],df7["b"],label=r'$\Omega_b=0.0232$')
plt.loglog(df8["a"],df8["b"],label=r'$\Omega_b=0.0234$')
plt.loglog(df9["a"],df9["b"],label=r'$\Omega_b=0.0235$')
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)$')
plt.grid()
plt.legend(loc=3)


Out[5]:
<matplotlib.legend.Legend at 0x7f04b96b8ef0>

In [6]:
plt.show()



In [7]:
plt.loglog(df["a"],df["b"]/planck["b"])
plt.loglog(df1["a"],df1["b"]/planck["b"])
plt.loglog(df2["a"],df2["b"]/planck["b"])
plt.loglog(df3["a"],df3["b"]/planck["b"])
plt.loglog(df4["a"],df4["b"]/planck["b"])
plt.loglog(df5["a"],df5["b"]/planck["b"])
plt.loglog(df6["a"],df6["b"]/planck["b"])
plt.loglog(df7["a"],df7["b"]/planck["b"])
plt.loglog(df8["a"],df8["b"]/planck["b"])
plt.loglog(df9["a"],df9["b"]/planck["b"])
plt.loglog(planck["a"],planck["b"]/planck["b"],label=r'Planck')
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)/P(k)_{planck}$')
plt.grid()

In [8]:
plt.show()


Changing $\Omega_m$


In [9]:
df = pd.read_table("omm/output1.txt", skiprows=5,header = None, sep=" ")
df.drop(df.columns[[2]],axis=1, inplace=True)
df1 = pd.read_table("omm/output2.txt", skiprows=5,header = None, sep=" ")
df1.drop(df1.columns[[2]],axis=1, inplace=True)
df2 = pd.read_table("omm/output3.txt", skiprows=5,header = None, sep=" ")
df2.drop(df2.columns[[2]],axis=1, inplace=True)
df3 = pd.read_table("omm/output4.txt", skiprows=5,header = None, sep=" ")
df3.drop(df3.columns[[2]],axis=1, inplace=True)
df4 = pd.read_table("omm/output5.txt", skiprows=5,header = None, sep=" ")
df4.drop(df4.columns[[2]],axis=1, inplace=True)
df5 = pd.read_table("omm/output6.txt", skiprows=5,header = None, sep=" ")
df5.drop(df5.columns[[2]],axis=1, inplace=True)
df6 = pd.read_table("omm/output7.txt", skiprows=5,header = None, sep=" ")
df6.drop(df6.columns[[2]],axis=1, inplace=True)
df7 = pd.read_table("omm/output8.txt", skiprows=5,header = None, sep=" ")
df7.drop(df7.columns[[2]],axis=1, inplace=True)
df8 = pd.read_table("omm/output9.txt", skiprows=5,header = None, sep=" ")
df8.drop(df8.columns[[2]],axis=1, inplace=True)
df9 = pd.read_table("omm/output10.txt", skiprows=5,header = None, sep=" ")
df9.drop(df9.columns[[2]],axis=1, inplace=True)

In [10]:
df.columns = ['a', 'b']
df1.columns = ['a', 'b']
df2.columns = ['a', 'b']
df3.columns = ['a', 'b']
df4.columns = ['a', 'b']
df5.columns = ['a', 'b']
df6.columns = ['a', 'b']
df7.columns = ['a', 'b']
df8.columns = ['a', 'b']
df9.columns = ['a', 'b']

Plot the data using Matplotlib


In [11]:
plt.loglog(df["a"],df["b"])
plt.loglog(df1["a"],df1["b"])
plt.loglog(df2["a"],df2["b"])
plt.loglog(df3["a"],df3["b"])
plt.loglog(df4["a"],df4["b"])
plt.loglog(df5["a"],df5["b"])
plt.loglog(df6["a"],df6["b"])
plt.loglog(df7["a"],df7["b"])
plt.loglog(df8["a"],df8["b"])
plt.loglog(df9["a"],df9["b"])
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)$')
plt.grid()
#plt.legend(loc=3)

In [12]:
plt.show()



In [13]:
plt.loglog(df["a"],df["b"]/planck["b"])
plt.loglog(df1["a"],df1["b"]/planck["b"])
plt.loglog(df2["a"],df2["b"]/planck["b"])
plt.loglog(df3["a"],df3["b"]/planck["b"])
plt.loglog(df4["a"],df4["b"]/planck["b"])
plt.loglog(df5["a"],df5["b"]/planck["b"])
plt.loglog(df6["a"],df6["b"]/planck["b"])
plt.loglog(df7["a"],df7["b"]/planck["b"])
plt.loglog(df8["a"],df8["b"]/planck["b"])
plt.loglog(df9["a"],df9["b"]/planck["b"])
plt.loglog(planck["a"],planck["b"]/planck["b"])
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)/P(k)_{planck}$')
plt.grid()
#plt.legend(loc=3)

In [14]:
plt.show()


Changing $n_s$


In [15]:
df = pd.read_table("ns/output1.txt", skiprows=5,header = None, sep=" ")
df.drop(df.columns[[2]],axis=1, inplace=True)
df1 = pd.read_table("ns/output2.txt", skiprows=5,header = None, sep=" ")
df1.drop(df1.columns[[2]],axis=1, inplace=True)
df2 = pd.read_table("ns/output3.txt", skiprows=5,header = None, sep=" ")
df2.drop(df2.columns[[2]],axis=1, inplace=True)
df3 = pd.read_table("ns/output4.txt", skiprows=5,header = None, sep=" ")
df3.drop(df3.columns[[2]],axis=1, inplace=True)
df4 = pd.read_table("ns/output5.txt", skiprows=5,header = None, sep=" ")
df4.drop(df4.columns[[2]],axis=1, inplace=True)
df5 = pd.read_table("ns/output6.txt", skiprows=5,header = None, sep=" ")
df5.drop(df5.columns[[2]],axis=1, inplace=True)
df6 = pd.read_table("ns/output7.txt", skiprows=5,header = None, sep=" ")
df6.drop(df6.columns[[2]],axis=1, inplace=True)
df7 = pd.read_table("ns/output8.txt", skiprows=5,header = None, sep=" ")
df7.drop(df7.columns[[2]],axis=1, inplace=True)
df8 = pd.read_table("ns/output9.txt", skiprows=5,header = None, sep=" ")
df8.drop(df8.columns[[2]],axis=1, inplace=True)
df9 = pd.read_table("ns/output10.txt", skiprows=5,header = None, sep=" ")
df9.drop(df9.columns[[2]],axis=1, inplace=True)

In [16]:
df.columns = ['a', 'b']
df1.columns = ['a', 'b']
df2.columns = ['a', 'b']
df3.columns = ['a', 'b']
df4.columns = ['a', 'b']
df5.columns = ['a', 'b']
df6.columns = ['a', 'b']
df7.columns = ['a', 'b']
df8.columns = ['a', 'b']
df9.columns = ['a', 'b']

Plot the data using Matplotlib


In [17]:
plt.loglog(df["a"],df["b"])
plt.loglog(df1["a"],df1["b"])
plt.loglog(df2["a"],df2["b"])
plt.loglog(df3["a"],df3["b"])
plt.loglog(df4["a"],df4["b"])
plt.loglog(df5["a"],df5["b"])
plt.loglog(df6["a"],df6["b"])
plt.loglog(df7["a"],df7["b"])
plt.loglog(df8["a"],df8["b"])
plt.loglog(df9["a"],df9["b"])
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)$')
plt.grid()
#plt.legend(loc=3)

In [18]:
plt.show()



In [19]:
plt.loglog(df["a"],df["b"]/planck["b"])
plt.loglog(df1["a"],df1["b"]/planck["b"])
plt.loglog(df2["a"],df2["b"]/planck["b"])
plt.loglog(df3["a"],df3["b"]/planck["b"])
plt.loglog(df4["a"],df4["b"]/planck["b"])
plt.loglog(df5["a"],df5["b"]/planck["b"])
plt.loglog(df6["a"],df6["b"]/planck["b"])
plt.loglog(df7["a"],df7["b"]/planck["b"])
plt.loglog(df8["a"],df8["b"]/planck["b"])
plt.loglog(df9["a"],df9["b"]/planck["b"])
plt.loglog(planck["a"],planck["b"]/planck["b"])
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)/P(k)_{planck}$')
plt.grid()
#plt.legend(loc=3)

In [20]:
plt.show()


Changing $\sigma_8$


In [21]:
df = pd.read_table("sigma_8/output1.txt", skiprows=5,header = None, sep=" ")
df.drop(df.columns[[2]],axis=1, inplace=True)
df1 = pd.read_table("sigma_8/output2.txt", skiprows=5,header = None, sep=" ")
df1.drop(df1.columns[[2]],axis=1, inplace=True)
df2 = pd.read_table("sigma_8/output3.txt", skiprows=5,header = None, sep=" ")
df2.drop(df2.columns[[2]],axis=1, inplace=True)
df3 = pd.read_table("sigma_8/output4.txt", skiprows=5,header = None, sep=" ")
df3.drop(df3.columns[[2]],axis=1, inplace=True)
df4 = pd.read_table("sigma_8/output5.txt", skiprows=5,header = None, sep=" ")
df4.drop(df4.columns[[2]],axis=1, inplace=True)
df5 = pd.read_table("sigma_8/output6.txt", skiprows=5,header = None, sep=" ")
df5.drop(df5.columns[[2]],axis=1, inplace=True)
df6 = pd.read_table("sigma_8/output7.txt", skiprows=5,header = None, sep=" ")
df6.drop(df6.columns[[2]],axis=1, inplace=True)
df7 = pd.read_table("sigma_8/output8.txt", skiprows=5,header = None, sep=" ")
df7.drop(df7.columns[[2]],axis=1, inplace=True)
df8 = pd.read_table("sigma_8/output9.txt", skiprows=5,header = None, sep=" ")
df8.drop(df8.columns[[2]],axis=1, inplace=True)
df9 = pd.read_table("sigma_8/output10.txt", skiprows=5,header = None, sep=" ")
df9.drop(df9.columns[[2]],axis=1, inplace=True)

In [22]:
df.columns = ['a', 'b']
df1.columns = ['a', 'b']
df2.columns = ['a', 'b']
df3.columns = ['a', 'b']
df4.columns = ['a', 'b']
df5.columns = ['a', 'b']
df6.columns = ['a', 'b']
df7.columns = ['a', 'b']
df8.columns = ['a', 'b']
df9.columns = ['a', 'b']

Plot the data using Matplotlib


In [23]:
plt.loglog(df["a"],df["b"])
plt.loglog(df1["a"],df1["b"])
plt.loglog(df2["a"],df2["b"])
plt.loglog(df3["a"],df3["b"])
plt.loglog(df4["a"],df4["b"])
plt.loglog(df5["a"],df5["b"])
plt.loglog(df6["a"],df6["b"])
plt.loglog(df7["a"],df7["b"])
plt.loglog(df8["a"],df8["b"])
plt.loglog(df9["a"],df9["b"])
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)$')
plt.grid()
#plt.legend(loc=3)

In [24]:
plt.show()



In [25]:
plt.loglog(df["a"],df["b"]/planck["b"])
plt.loglog(df1["a"],df1["b"]/planck["b"])
plt.loglog(df2["a"],df2["b"]/planck["b"])
plt.loglog(df3["a"],df3["b"]/planck["b"])
plt.loglog(df4["a"],df4["b"]/planck["b"])
plt.loglog(df5["a"],df5["b"]/planck["b"])
plt.loglog(df6["a"],df6["b"]/planck["b"])
plt.loglog(df7["a"],df7["b"]/planck["b"])
plt.loglog(df8["a"],df8["b"]/planck["b"])
plt.loglog(df9["a"],df9["b"]/planck["b"])
plt.loglog(planck["a"],planck["b"]/planck["b"])
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)/P(k)_{planck}$')
plt.grid()
#plt.legend(loc=3)

In [26]:
plt.show()


Changing $w$


In [27]:
df = pd.read_table("w/output1.txt", skiprows=5,header = None, sep=" ")
df.drop(df.columns[[2]],axis=1, inplace=True)
df1 = pd.read_table("w/output2.txt", skiprows=5,header = None, sep=" ")
df1.drop(df1.columns[[2]],axis=1, inplace=True)
df2 = pd.read_table("w/output3.txt", skiprows=5,header = None, sep=" ")
df2.drop(df2.columns[[2]],axis=1, inplace=True)
df3 = pd.read_table("w/output4.txt", skiprows=5,header = None, sep=" ")
df3.drop(df3.columns[[2]],axis=1, inplace=True)
df4 = pd.read_table("w/output5.txt", skiprows=5,header = None, sep=" ")
df4.drop(df4.columns[[2]],axis=1, inplace=True)
df5 = pd.read_table("w/output6.txt", skiprows=5,header = None, sep=" ")
df5.drop(df5.columns[[2]],axis=1, inplace=True)
df6 = pd.read_table("w/output7.txt", skiprows=5,header = None, sep=" ")
df6.drop(df6.columns[[2]],axis=1, inplace=True)
df7 = pd.read_table("w/output8.txt", skiprows=5,header = None, sep=" ")
df7.drop(df7.columns[[2]],axis=1, inplace=True)
df8 = pd.read_table("w/output9.txt", skiprows=5,header = None, sep=" ")
df8.drop(df8.columns[[2]],axis=1, inplace=True)
df9 = pd.read_table("w/output10.txt", skiprows=5,header = None, sep=" ")
df9.drop(df9.columns[[2]],axis=1, inplace=True)

In [28]:
df.columns = ['a', 'b']
df1.columns = ['a', 'b']
df2.columns = ['a', 'b']
df3.columns = ['a', 'b']
df4.columns = ['a', 'b']
df5.columns = ['a', 'b']
df6.columns = ['a', 'b']
df7.columns = ['a', 'b']
df8.columns = ['a', 'b']
df9.columns = ['a', 'b']

Plot the data using Matplotlib


In [29]:
plt.loglog(df["a"],df["b"])
plt.loglog(df1["a"],df1["b"])
plt.loglog(df2["a"],df2["b"])
plt.loglog(df3["a"],df3["b"])
plt.loglog(df4["a"],df4["b"])
plt.loglog(df5["a"],df5["b"])
plt.loglog(df6["a"],df6["b"])
plt.loglog(df7["a"],df7["b"])
plt.loglog(df8["a"],df8["b"])
plt.loglog(df9["a"],df9["b"])
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)$')
plt.grid()
#plt.legend(loc=3)

In [30]:
plt.show()



In [31]:
plt.loglog(df["a"],df["b"]/planck["b"])
plt.loglog(df1["a"],df1["b"]/planck["b"])
plt.loglog(df2["a"],df2["b"]/planck["b"])
plt.loglog(df3["a"],df3["b"]/planck["b"])
plt.loglog(df4["a"],df4["b"]/planck["b"])
plt.loglog(df5["a"],df5["b"]/planck["b"])
plt.loglog(df6["a"],df6["b"]/planck["b"])
plt.loglog(df7["a"],df7["b"]/planck["b"])
plt.loglog(df8["a"],df8["b"]/planck["b"])
plt.loglog(df9["a"],df9["b"]/planck["b"])
plt.loglog(planck["a"],planck["b"]/planck["b"])
plt.xlabel(r'$k$')
plt.ylabel(r'$P(k)/P(k)_{planck}$')
plt.grid()
#plt.legend(loc=3)

In [32]:
plt.show()