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")
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')
Out[3]:
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')
In [ ]:
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]:
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]:
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]:
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]:
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]:
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]:
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]: