In [5]:
from astropy import cosmology as cosmo
c=cosmo.FlatLambdaCDM(H0=72.0,Om0=1,Tcmb0=0.0,Neff=0.0,name="simple flat")

$\rho$


In [3]:
from numpy import matlib as ml
from scipy.optimize import curve_fit

def f(x,a,b,c):
    return a*(x+b)**(2.0/3.0) + c

#r indices
ind=100

#inputs
R=np.genfromtxt('R.dat');
r,M,tB,E=np.genfromtxt('model_fun.dat',unpack=True)
t,t1=np.genfromtxt('t.dat',unpack=True)
rho = np.genfromtxt('rho_a.dat');
rho=rho[:,ind]

#scale factor
a=ml.repmat(r,R.shape[0],1)
a=R/a
#actual value of scale factor
a0=a[0,0]
#a0=1.0
#scale factor a0 -> 1
#a=a/a0

#G gravitational constant
G=6.67300e-11 * 1.98892e40 / 3.08568025e22 / (299792458.0*299792458.0)
#Hubble paramaeter 100h^{-1} Gpc^{-1}
H0 = 100.0 / 299792.458 * 1000
#critical density
ro0 = 3.0*H0*H0/(8*pi*G)
#tB - time of Big Bang (like in LTB tB(r)) 
tB = 0.0

#constant from integreting Friedmann equation to get a(t) dependencies
iconst=(6*pi*G*ro0)**(1.0/3.0)
#a -analytic formula k=0
a_flrw = (iconst)*(t[:]-tB)**(2.0/3.0)
#rho analytic formula - > Friedman eq + Fluid eq.
rho_flrw = ro0 /(a_flrw**3)

print rho_flrw.max()/rho.max()
ratio=rho_flrw/rho

#plotting
clf()
plot(t[10:],rho_flrw[10:],'b-')
plot(t[10:],5*rho[10:],'r+')

#curve fit
#popt, pcov=curve_fit(f,t[:],a[:,ind])
#plot(t[:],f(t[:],popt[0],popt[1],popt[2]),'b')


ro0=27751973.7513
5.00002191177
Out[3]:
[<matplotlib.lines.Line2D at 0xa00be4c>]

a(t)


In [5]:
from numpy import matlib as ml
from scipy.optimize import curve_fit

def f(x,a,b,c):
    return a*(x+b)**(2.0/3.0) + c

R=np.genfromtxt('R.dat');
r,M,tB,E=np.genfromtxt('model_fun.dat',unpack=True)
t,t1=np.genfromtxt('t.dat',unpack=True)
#r indices
ind=3
#scale factor
a=ml.repmat(r,R.shape[0],1)
a=R/a
#actual value of scale factor
#a0=a[0,0]
a0=1.0
#scale factor a0 -> 1
#a=a/a0
#G gravitational constant
G=6.67300e-11 * 1.98892e40 / 3.08568025e22 / (299792458.0*299792458.0)
#Hubble paramaeter 100h^{-1} Gpc^{-1}
H0 = 100.0 / 299792.458 * 1000
#critical density
ro0 = 3.0*H0*H0/(8*pi*G)
print "ro0={0}".format(ro0)
#tB - time of Big Bang (like in LTB tB(r)) 
tB = 0.0
#constant from integreting Friedmann equation to get a(t) dependencies
iconst=(6*pi*G*ro0)**(1.0/3.0)
a_flrw = (iconst)*(t[:]-tB)**(2.0/3.0)

#plotting
clf()
plot(t[:],a[:,ind],'r+')
plot(t[:],a_flrw,'b-')
#plot(t[:],(iconst)*(t[:]-tB)**(2.0/3.0),'b')
#curve fit
#popt, pcov=curve_fit(f,t[:],a[:,ind])
#plot(t[:],f(t[:],popt[0],popt[1],popt[2]),'b')


ro0=27751973.7513
2.99299904993e-06

In [ ]:

a(r)


In [2]:
from numpy import matlib as ml
R=np.genfromtxt('R.dat');
r,M,tB,E=np.genfromtxt('model_fun.dat',unpack=True)
rr=ml.repmat(r,R.shape[0],1)
ind=3
#S=R/rr
S=R
clf()
plot(r[1:-1],S[0,1:-1],'r')
plot(r[1:-1],S[1,1:-1],'g')
plot(r[1:-1],S[2,1:-1],'b')
plot(r[1:-1],S[3,1:-1],'c')


Out[2]:
[<matplotlib.lines.Line2D at 0x9d57f4c>]

In [22]:
from numpy import matlib as ml
R=np.genfromtxt('R.dat');
R_r=np.genfromtxt('R_r_a.dat');
R_t=np.genfromtxt('R_t_a.dat');
r,M,tB,E=np.genfromtxt('model_fun.dat',unpack=True)
t,t1=np.genfromtxt('t.dat',unpack=True)
ind=3
clf()
plot(r[:],R_t[0,:],'ro')
plot(r[:],R_t[1,:],'g--')
plot(r[:],R_t[2,:],'b--')
plot(r[:],R_t[3,:],'y.')


Out[22]:
[<matplotlib.lines.Line2D at 0xb38b06c>]

In [23]:
from numpy import matlib as ml
R_r=np.genfromtxt('R_r_a.dat');
r,M,tB,E=np.genfromtxt('model_fun.dat',unpack=True)
t,t1=np.genfromtxt('t.dat',unpack=True)
ind=3
clf()
plot(r[:],R_r[0,:],'ro')
plot(r[:],R_r[1,:],'g--')
plot(r[:],R_r[2,:],'b--')
plot(r[:],R_r[3,:],'y.')


Out[23]:
[<matplotlib.lines.Line2D at 0xbc9832c>]

In [24]:
from astropy import cosmology as cosmo
c=cosmo.FlatLambdaCDM(H0=100.0,Om0=1,Tcmb0=0.0,Neff=0.0,name="simple flat")
from numpy import matlib as ml
R=np.genfromtxt('R.dat');
exp=np.genfromtxt('exp_a.dat');
r,M,tB,E=np.genfromtxt('model_fun.dat',unpack=True)
t,t1=np.genfromtxt('t.dat',unpack=True)
ind=1
clf()
#plot(t[:],c.H(t))
#print r[0],r[1],r[2],r[3]
#plot(t[:],exp[:,0],'c--')
plot(t[:],exp[:,1],'r')
#plot(t[:],exp[:,2],'g+')

plot(t[:],exp[:,3],'b.')
plot(t[:],exp[:,4],'y.')


Out[24]:
[<matplotlib.lines.Line2D at 0xe69992c>]

H(a)


In [3]:
from numpy import matlib as ml
R=np.genfromtxt('R.dat');
exp=np.genfromtxt('exp_a.dat');
r,M,tB,E=np.genfromtxt('model_fun.dat',unpack=True)
ind=4
#scale factors
a=ml.repmat(r,R.shape[0],1)
a = R / a
#Hubble
H0=100.0 / 299792.458 * 1000
a1 = H0/ a**1.5
z1=a1[:,ind]
#z1=z1/z1.max()
z2=exp[:,ind]
#z2=z2/z2.max()
clf()
plot(a[:,ind],z1,'r')
plot(a[:,ind],z2,'b--')


Out[3]:
[<matplotlib.lines.Line2D at 0xdb9a32c>]

$g_{rr}(t)$


In [4]:
from numpy import matlib as ml
R=np.genfromtxt('R.dat');
grr=np.genfromtxt('grr.dat');
r,M,tB,E=np.genfromtxt('model_fun.dat',unpack=True)
t,t1=np.genfromtxt('t.dat',unpack=True)
ind=1
clf()
plot(t[:],grr[:,ind],'r')


Out[4]:
[<matplotlib.lines.Line2D at 0xdf9efcc>]

$\rho(t)$


In [2]:
from numpy import matlib as ml
R=np.genfromtxt('R.dat');
rho=np.genfromtxt('rho_a.dat')
r,M,tB,E=np.genfromtxt('model_fun.dat',unpack=True)
t,t1=np.genfromtxt('t.dat',unpack=True)
ind=1
clf()

plot(t[:],rho[:,1],'r')


Out[2]:
[<matplotlib.lines.Line2D at 0xc48686c>]