-
Notifications
You must be signed in to change notification settings - Fork 0
/
energy_density.py
85 lines (66 loc) · 2.59 KB
/
energy_density.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import matplotlib.pylab as pylab
import matplotlib.pyplot as plt
import numpy as np
from src.lscdm import *
# ==================== PARAMETERS ====================
# --------------------- LsCDM
z_dag = 1.70
a_dag = 1/(1 + z_dag)
Om0_lscdm = Om0_finder_LsCDM(z_dag)
Om0_Ode0_ratio = Om0_lscdm / (1 - Om0_lscdm)
rho_tot_a_dag = Om0_Ode0_ratio * a_dag**(-3)
# --------------------- Initial Scale Factor
a_ini = 0.30
a_vals = np.linspace(a_ini, 1, 10000)
z_vals = 1/a_vals - 1
# ==================== NUMERICAL ANALYSIS ====================
def rho_LsCDM(a, eta):
return Om0_Ode0_ratio*a**(-3) + np.tanh(eta*(a - a_dag)) / np.tanh(eta * (1 - a_dag))
rho_lscdm_vals_1 = rho_LsCDM(a_vals, 50)
rho_lscdm_vals_2 = rho_LsCDM(a_vals, 100)
rho_lscdm_vals_3 = rho_LsCDM(a_vals, 200)
rho_lscdm_vals_4 = rho_LsCDM(a_vals, 100000)
# ==================== PLOT ====================
# LaTeX rendering text fonts
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
# Adjusting the size of the figure
params = {'legend.fontsize': '30',
'axes.labelsize': '44',
'figure.figsize': (15, 10),
'xtick.labelsize': '44',
'ytick.labelsize': '44'}
pylab.rcParams.update(params)
fig, ax0 = plt.subplots()
ax0.plot(a_vals, rho_lscdm_vals_1, color='red', ls='-',
lw=3.5, label=r'$\sigma=50$')
ax0.plot(a_vals, rho_lscdm_vals_2, color='blue', ls='-',
lw=3.5, label=r'$\sigma=100$')
ax0.plot(a_vals, rho_lscdm_vals_3, color='orange', ls='-',
lw=3.5, label=r'$\sigma=200$')
ax0.plot(a_vals, rho_lscdm_vals_4, color='black', ls='-',
lw=3.5, label=r'$\sigma \rightarrow \infty$')
ax0.axvline(x=a_dag, color='brown', ls='--', lw=2.5, label=r'$a_{\dagger}=0.3704$')
ax0.axhline(y=rho_tot_a_dag, color='green', ls='-.', lw=3.0,
label=r'$\rho_{\rm tot} \equiv \rho_{\rm m0}a_{\dagger}^{-3}$')
# --------------------- Graph Options
# Setting Limits
ax0.set_xlim(0.275, 0.475)
ax0.set_ylim(0, 12)
# Set Titles
ax0.set_xlabel('$a$')
ax0.set_ylabel(r'$\rho_{\rm tot} / \rho_{\Lambda_{\rm s}0}$')
# Tick options
ax0.set_xticks([0.275, 0.325, 0.375, 0.425, 0.475])
ax0.xaxis.set_ticks_position('both')
ax0.yaxis.set_ticks_position('both')
ax0.xaxis.set_tick_params(which='major', width=1.5, size=13.0, direction='in')
ax0.xaxis.set_tick_params(which='minor', width=1.0, size=6.50, direction='in')
ax0.yaxis.set_tick_params(which='major', width=1.5, size=13.0, direction='in')
ax0.yaxis.set_tick_params(which='minor', width=1.0, size=6.50, direction='in')
ax0.minorticks_on()
# Other Options
ax0.legend()
plt.tight_layout()
plt.savefig(r'log\energyDensity.pdf', format='pdf', dpi=400)
plt.show()