Skip to content

Commit

Permalink
Modified cooling time plots
Browse files Browse the repository at this point in the history
  • Loading branch information
clairekope committed Feb 9, 2023
1 parent 2eda141 commit 75dafb4
Showing 1 changed file with 87 additions and 75 deletions.
162 changes: 87 additions & 75 deletions plot_tcool_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D

fid = np.genfromtxt("../extracted_data/fid_tcool_mass_dist_CGM.txt")
cflow = np.genfromtxt("../extracted_data/cflow_tcool_mass_dist_CGM.txt")
tctff5 = np.genfromtxt("../extracted_data/tctff5_tcool_mass_dist_CGM.txt")
tctff20 = np.genfromtxt("../extracted_data/tctff20_tcool_mass_dist_CGM.txt")
linrot = np.genfromtxt("../extracted_data/linrot_tcool_mass_dist_CGM.txt")
norot = np.genfromtxt("../extracted_data/norot_tcool_mass_dist_CGM.txt")

fid_disk = np.genfromtxt("../extracted_data/fid_tcool_mass_dist_CGM-disk.txt")
cflow_disk = np.genfromtxt("../extracted_data/cflow_tcool_mass_dist_CGM-disk.txt")
tctff5_disk = np.genfromtxt("../extracted_data/tctff5_tcool_mass_dist_CGM-disk.txt")
tctff20_disk = np.genfromtxt("../extracted_data/tctff20_tcool_mass_dist_CGM-disk.txt")
linrot_disk = np.genfromtxt("../extracted_data/linrot_tcool_mass_dist_CGM-disk.txt")
norot_disk = np.genfromtxt("../extracted_data/norot_tcool_mass_dist_CGM-disk.txt")
fid = np.genfromtxt("../original_sims/extracted_data/fid_tcool_mass_dist_CGM.txt")
cflow = np.genfromtxt("../original_sims/extracted_data/cflow_tcool_mass_dist_CGM.txt")
tctff5 = np.genfromtxt("../original_sims/extracted_data/tctff5_tcool_mass_dist_CGM.txt")
tctff20 = np.genfromtxt("../original_sims/extracted_data/tctff20_tcool_mass_dist_CGM.txt")
linrot = np.genfromtxt("../original_sims/extracted_data/linrot_tcool_mass_dist_CGM.txt")
norot = np.genfromtxt("../original_sims/extracted_data/norot_tcool_mass_dist_CGM.txt")

fid_disk = np.genfromtxt("../original_sims/extracted_data/fid_tcool_mass_dist_CGM-disk.txt")
cflow_disk = np.genfromtxt("../original_sims/extracted_data/cflow_tcool_mass_dist_CGM-disk.txt")
tctff5_disk = np.genfromtxt("../original_sims/extracted_data/tctff5_tcool_mass_dist_CGM-disk.txt")
tctff20_disk = np.genfromtxt("../original_sims/extracted_data/tctff20_tcool_mass_dist_CGM-disk.txt")
linrot_disk = np.genfromtxt("../original_sims/extracted_data/linrot_tcool_mass_dist_CGM-disk.txt")
norot_disk = np.genfromtxt("../original_sims/extracted_data/norot_tcool_mass_dist_CGM-disk.txt")

fig, ax = plt.subplots(nrows=3, ncols=5, sharex=True, sharey=True, figsize=(11,7))

Expand Down Expand Up @@ -124,7 +124,7 @@
ax[0,0].set_xlim(1e-1, 1e2)

for i in range(3):
ax[i,0].set_ylabel(r"$M(t_{\rm c} < t_{\rm c,0})$", fontsize='large')
ax[i,0].set_ylabel(r"$M(t_{\rm c} < t_{\rm c,0})\ \mathrm{[M_\odot]}$", fontsize='large')
# for j in range(5):
# ax[i,j].grid()
# ax[i,j].axvline(1, c='gray', ls='--')
Expand All @@ -143,168 +143,180 @@
ax[i,j].grid(axis='both')

fig.tight_layout()
fig.savefig("../fig_tcool-mass-dist_cumm-big.pdf")
fig.savefig("../original_sims/figures/fig_tcool-mass-dist_cumm-big.pdf")



fig, ax = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True, figsize=(5,5))
fig, ax = plt.subplots(nrows=3, ncols=2, sharex=True, sharey=True, figsize=(5,5))

lb = 26
ub = -20

# ax[0].loglog(fid[:,0], fid[:, 1]/np.sum(fid[:43, 1]), c='C0')
ax[0,0].loglog(fid[:,0],
np.cumsum(fid[:, 21])/np.cumsum(fid[:, 21])[-1],
np.cumsum(fid[:, 1])/np.cumsum(fid[:, 1])[-1],
c='C0', label='Fid')
ax[0,1].loglog(fid[:,0],
np.cumsum(fid[:, 21])/np.cumsum(fid[:, 21])[-1],
c='C0', label='Fid')
ax[1,0].loglog(fid[:,0],
np.cumsum(fid[:, 41])/np.cumsum(fid[:, 41])[-1],
c='C0')
ax[1,0].loglog(fid[:,0],
ax[1,1].loglog(fid[:,0],
np.cumsum(fid[:, 61])/np.cumsum(fid[:, 61])[-1],
c='C0')
ax[1,1].loglog(fid[:,0],
ax[2,0].loglog(fid[:,0],
np.cumsum(fid[:, 81])/np.cumsum(fid[:, 81])[-1],
c='C0')

# ax[0].loglog(tctff5[:,0], tctff5[:, 1]/np.sum(tctff5[:43, 1]), c='C2')
ax[0,0].loglog(tctff5[:,0],
np.cumsum(tctff5[:, 21]) / np.cumsum(tctff5[:, 21])[-1],
np.cumsum(tctff5[:, 1]) / np.cumsum(tctff5[:, 1])[-1],
c='C2', label='LowRatio')
ax[0,1].loglog(tctff5[:,0],
np.cumsum(tctff5[:, 21]) / np.cumsum(tctff5[:, 21])[-1],
c='C2', label='LowRatio')
ax[1,0].loglog(tctff5[:,0],
np.cumsum(tctff5[:, 41]) / np.cumsum(tctff5[:, 41])[-1],
c='C2')
ax[1,0].loglog(tctff5[:,0],
ax[1,1].loglog(tctff5[:,0],
np.cumsum(tctff5[:, 61]) / np.cumsum(tctff5[:, 61])[-1],
c='C2')
ax[1,1].loglog(tctff5[:,0],
ax[2,0].loglog(tctff5[:,0],
np.cumsum(tctff5[:, 81]) / np.cumsum(tctff5[:, 81])[-1],
c='C2')

# ax[0].loglog(tctff20[:,0], tctff20[:, 1]/np.sum(tctff20[:43, 1]), c='C1')
ax[0,0].loglog(tctff20[:,0],
np.cumsum(tctff20[:, 21]) / np.cumsum(tctff20[:, 21])[-1],
np.cumsum(tctff20[:, 1]) / np.cumsum(tctff20[:, 1])[-1],
c='C1', label='HighRatio')
ax[0,1].loglog(tctff20[:,0],
np.cumsum(tctff20[:, 21]) / np.cumsum(tctff20[:, 21])[-1],
c='C1', label='HighRatio')
ax[1,0].loglog(tctff20[:,0],
np.cumsum(tctff20[:, 41]) / np.cumsum(tctff20[:, 41])[-1],
c='C1')
ax[1,0].loglog(tctff20[:,0],
ax[1,1].loglog(tctff20[:,0],
np.cumsum(tctff20[:, 61]) / np.cumsum(tctff20[:, 61])[-1],
c='C1')
ax[1,1].loglog(tctff20[:,0],
ax[2,0].loglog(tctff20[:,0],
np.cumsum(tctff20[:, 81]) / np.cumsum(tctff20[:, 81])[-1],
c='C1')

ax[0,0].legend(framealpha=1)
ax[0,1].legend(framealpha=1)

ax[0,0].text(0.05, 0.9, '1 Gyr', transform=ax[0,0].transAxes, fontweight='bold',
ax[0,0].text(0.05, 0.9, '0 Gyr', transform=ax[0,0].transAxes, fontweight='bold',
ha='left', va='top')
ax[0,1].text(0.05, 0.9, '2 Gyr', transform=ax[0,1].transAxes, fontweight='bold',
ax[0,1].text(0.05, 0.9, '1 Gyr', transform=ax[0,1].transAxes, fontweight='bold',
ha='left', va='top')
ax[1,0].text(0.05, 0.9, '3 Gyr', transform=ax[1,0].transAxes, fontweight='bold',
ax[1,0].text(0.05, 0.9, '2 Gyr', transform=ax[1,0].transAxes, fontweight='bold',
ha='left', va='top')
ax[1,1].text(0.05, 0.9, '4 Gyr', transform=ax[1,1].transAxes, fontweight='bold',
ax[1,1].text(0.05, 0.9, '3 Gyr', transform=ax[1,1].transAxes, fontweight='bold',
ha='left', va='top')
ax[2,0].text(0.05, 0.9, '4 Gyr', transform=ax[2,0].transAxes, fontweight='bold',
ha='left', va='top')

# ax[0,0].set_title('0 Gyr')
# ax[0,1].set_title('1 Gyr')
# ax[0,2].set_title('2 Gyr')
# ax[0,3].set_title('3 Gyr')
# ax[0,4].set_title('4 Gyr')

ax[0,0].set_xlim(1e-1, 1e2)
ax[0,0].set_ylim(1e-3,1.5e0)

for i in range(2):
ax[i,0].set_ylabel(r"Mass PDF", fontsize='large')
ax[1,i].set_xlabel(r"$t_{\rm c}$ [Gyr]", fontsize='large')
for j in range(2):
ax[i,j].grid()

ax[0,0].set_ylim(1e-3,1.5e0)
#ax[0,0].yaxis.set_major_locator(FixedLocator([1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e0]))
#ax[0,0].set_xticks([1e-2,1e-1,1e0,1e1,1e2,1e3,1e4,1e5])
#ax[0,0].set_xticklabels(['$10^{-2}$','','$10^{0}$','','$10^{2}$','','$10^4$',''])
ax[2,0].grid()
ax[2,1].set_axis_off()
ax[1,1].tick_params(labelbottom=True)

ax[2,0].set_ylabel(r"Mass PDF", fontsize='large')
ax[2,0].set_xlabel(r"$t_{\rm c,0}$ [Gyr]", fontsize='large')
ax[1,1].set_xlabel(r"$t_{\rm c,0}$ [Gyr]", fontsize='large')

fig.tight_layout()
fig.savefig("../fig_tcool-mass-dist_tctff-var.pdf")
fig.subplots_adjust(hspace=0.1)
fig.savefig("../original_sims/figures/fig_tcool-mass-dist_tctff-var.pdf")



fig, ax = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True, figsize=(5,5))
fig, ax = plt.subplots(nrows=3, ncols=2, sharex=True, sharey=True, figsize=(5,5))

lb = 26
ub = -20

# ax[0].loglog(fid[:,0], fid[:, 1]/np.sum(fid[:43, 1]), c='C0')
ax[0,0].loglog(fid[:,0],
np.cumsum(fid[:, 21])/np.cumsum(fid[:, 21])[-1],
np.cumsum(fid[:, 1])/np.cumsum(fid[:, 1])[-1],
c='C0', label='Fid')
ax[0,1].loglog(fid[:,0],
np.cumsum(fid[:, 21])/np.cumsum(fid[:, 21])[-1],
c='C0', label='Fid')
ax[1,0].loglog(fid[:,0],
np.cumsum(fid[:, 41])/np.cumsum(fid[:, 41])[-1],
c='C0')
ax[1,0].loglog(fid[:,0],
ax[1,1].loglog(fid[:,0],
np.cumsum(fid[:, 61])/np.cumsum(fid[:, 61])[-1],
c='C0')
ax[1,1].loglog(fid[:,0],
ax[2,0].loglog(fid[:,0],
np.cumsum(fid[:, 81])/np.cumsum(fid[:, 81])[-1],
c='C0')

# ax[0].loglog(linrot[:,0], linrot[:, 1]/np.sum(linrot[:43, 1]), c='C2')
ax[0,0].loglog(linrot[:,0],
np.cumsum(linrot[:, 21]) / np.cumsum(linrot[:, 21])[-1],
np.cumsum(linrot[:, 1]) / np.cumsum(linrot[:, 1])[-1],
c='C4', label='LinRot')
ax[0,1].loglog(linrot[:,0],
np.cumsum(linrot[:, 21]) / np.cumsum(linrot[:, 21])[-1],
c='C4', label='LinRot')
ax[1,0].loglog(linrot[:,0],
np.cumsum(linrot[:, 41]) / np.cumsum(linrot[:, 41])[-1],
c='C4')
ax[1,0].loglog(linrot[:,0],
ax[1,1].loglog(linrot[:,0],
np.cumsum(linrot[:, 61]) / np.cumsum(linrot[:, 61])[-1],
c='C4')
ax[1,1].loglog(linrot[:,0],
ax[2,0].loglog(linrot[:,0],
np.cumsum(linrot[:, 81]) / np.cumsum(linrot[:, 81])[-1],
c='C4')

# ax[0].loglog(norot[:,0], norot[:, 1]/np.sum(norot[:43, 1]), c='C1')
ax[0,0].loglog(norot[:,0],
np.cumsum(norot[:, 21]) / np.cumsum(norot[:, 21])[-1],
np.cumsum(norot[:, 1]) / np.cumsum(norot[:, 1])[-1],
c='C5', label='NoRot')
ax[0,1].loglog(norot[:,0],
np.cumsum(norot[:, 21]) / np.cumsum(norot[:, 21])[-1],
c='C5', label='NoRot')
ax[1,0].loglog(norot[:,0],
np.cumsum(norot[:, 41]) / np.cumsum(norot[:, 41])[-1],
c='C5')
ax[1,0].loglog(norot[:,0],
ax[1,1].loglog(norot[:,0],
np.cumsum(norot[:, 61]) / np.cumsum(norot[:, 61])[-1],
c='C5')
ax[1,1].loglog(norot[:,0],
ax[2,0].loglog(norot[:,0],
np.cumsum(norot[:, 81]) / np.cumsum(norot[:, 81])[-1],
c='C5')

ax[0,0].legend(framealpha=1)
ax[0,1].legend(framealpha=1)

ax[0,0].text(0.05, 0.9, '1 Gyr', transform=ax[0,0].transAxes, fontweight='bold',
ax[0,0].text(0.05, 0.9, '0 Gyr', transform=ax[0,0].transAxes, fontweight='bold',
ha='left', va='top')
ax[0,1].text(0.05, 0.9, '2 Gyr', transform=ax[0,1].transAxes, fontweight='bold',
ax[0,1].text(0.05, 0.9, '1 Gyr', transform=ax[0,1].transAxes, fontweight='bold',
ha='left', va='top')
ax[1,0].text(0.05, 0.9, '3 Gyr', transform=ax[1,0].transAxes, fontweight='bold',
ax[1,0].text(0.05, 0.9, '2 Gyr', transform=ax[1,0].transAxes, fontweight='bold',
ha='left', va='top')
ax[1,1].text(0.05, 0.9, '4 Gyr', transform=ax[1,1].transAxes, fontweight='bold',
ax[1,1].text(0.05, 0.9, '3 Gyr', transform=ax[1,1].transAxes, fontweight='bold',
ha='left', va='top')
ax[2,0].text(0.05, 0.9, '4 Gyr', transform=ax[2,0].transAxes, fontweight='bold',
ha='left', va='top')

# ax[0,0].set_title('0 Gyr')
# ax[0,1].set_title('1 Gyr')
# ax[0,2].set_title('2 Gyr')
# ax[0,3].set_title('3 Gyr')
# ax[0,4].set_title('4 Gyr')

ax[0,0].set_xlim(1e-1, 1e2)
ax[0,0].set_ylim(1e-3,1.5e0)

for i in range(2):
ax[i,0].set_ylabel(r"Mass PDF", fontsize='large')
ax[1,i].set_xlabel(r"$t_{\rm c}$ [Gyr]", fontsize='large')
for j in range(2):
ax[i,j].grid()

ax[0,0].set_ylim(1e-3,1.5e0)
#ax[0,0].yaxis.set_major_locator(FixedLocator([1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e0]))
#ax[0,0].set_xticks([1e-2,1e-1,1e0,1e1,1e2,1e3,1e4,1e5])
#ax[0,0].set_xticklabels(['$10^{-2}$','','$10^{0}$','','$10^{2}$','','$10^4$',''])
ax[2,0].grid()
ax[2,1].set_axis_off()
ax[1,1].tick_params(labelbottom=True)

ax[2,0].set_ylabel(r"Mass PDF", fontsize='large')
ax[2,0].set_xlabel(r"$t_{\rm c,0}$ [Gyr]", fontsize='large')
ax[1,1].set_xlabel(r"$t_{\rm c,0}$ [Gyr]", fontsize='large')

fig.tight_layout()
fig.savefig("../fig_tcool-mass-dist_rot-var.pdf")
fig.subplots_adjust(hspace=0.1)
fig.savefig("../original_sims/figures/fig_tcool-mass-dist_rot-var.pdf")

0 comments on commit 75dafb4

Please sign in to comment.