Skip to content

Commit

Permalink
Updating python scripts and adding more obs data
Browse files Browse the repository at this point in the history
  • Loading branch information
cdplagos committed Feb 20, 2025
1 parent 9111f4e commit 3e27181
Show file tree
Hide file tree
Showing 24 changed files with 1,371 additions and 78 deletions.
50 changes: 50 additions & 0 deletions data/lf/Halpha/GAMA_Halpha.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Gunawardhana et al. (2013)
# Densities phi in Mpc^-3 dex^-1.
# z<0.1
# logL log phi Lower Error Upper Error
3.02e+01 -4.741e-01 2.0 3.010e-01
3.06e+01 -7.781e-01 3.010e-01 1.761e-01
3.10e+01 -8.362e-01 1.895e-01 1.315e-01
3.14e+01 -1.189e+00 1.558e-01 1.144e-01
3.18e+01 -1.426e+00 9.915e-02 8.067e-02
3.22e+01 -1.340e+00 4.576e-02 4.139e-02
3.26e+01 -1.249e+00 2.701e-02 2.543e-02
3.30e+01 -1.467e+00 1.628e-02 1.569e-02
3.34e+01 -1.565e+00 1.062e-02 1.037e-02
3.38e+01 -1.778e+00 9.804e-03 9.588e-03
3.42e+01 -2.114e+00 1.085e-02 1.058e-02
3.46e+01 -2.466e+00 1.430e-02 1.385e-02
3.50e+01 -2.980e+00 2.422e-02 2.294e-02
3.54e+01 -3.690e+00 5.899e-02 5.192e-02
3.58e+01 -4.542e+00 1.558e-01 1.144e-01
# 0.1<z<0.15
3.35e+01 -2.260e+00 1.890e-02 1.810e-02
3.39e+01 -2.202e+00 8.713e-03 8.541e-03
3.43e+01 -2.262e+00 7.916e-03 7.775e-03
3.47e+01 -2.477e+00 9.100e-03 8.913e-03
3.51e+01 -2.917e+00 1.375e-02 1.333e-02
3.55e+01 -3.613e+00 3.160e-02 2.946e-02
3.59e+01 -4.549e+00 9.915e-02 8.067e-02
3.63e+01 -5.389e+00 3.010e-01 1.761e-01
3.67e+01 -5.999e+00 2.0 3.010e-01
# 0.17<z0.24
3.39e+01 -2.960e+00 2.046e-02 1.954e-02
3.43e+01 -2.551e+00 8.923e-03 8.743e-03
3.47e+01 -2.563e+00 7.342e-03 7.219e-03
3.51e+01 -2.886e+00 8.824e-03 8.648e-03
3.55e+01 -3.484e+00 1.536e-02 1.484e-02
3.59e+01 -4.291e+00 4.460e-02 4.044e-02
3.63e+01 -5.327e+00 1.411e-01 1.063e-01
3.67e+01 -5.776e+00 2.574e-01 1.605e-01
3.71e+01 -5.893e+00 3.010e-01 1.761e-01
# 0.24<z<0.34
3.39e+01 -4.731e+00 3.010e-01 1.761e-01
3.43e+01 -3.375e+00 2.124e-02 2.025e-02
3.47e+01 -2.870e+00 8.714e-03 8.543e-03
3.51e+01 -2.927e+00 7.846e-03 7.706e-03
3.55e+01 -3.507e+00 1.168e-02 1.138e-02
3.59e+01 -4.397e+00 2.843e-02 2.669e-02
3.63e+01 -5.267e+00 8.307e-02 6.970e-02
3.67e+01 -5.663e+00 1.761e-01 1.249e-01
3.71e+01 -6.276e+00 3.010e-01 1.761e-01
3.75e+01 -6.428e+00 3.740e-01 1.979e-01
14 changes: 14 additions & 0 deletions data/lf/Halpha/Haynes_2010_z2p2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#"log(phi)(log(Lalpha/ erg/s)) created by Plot Digitizer 2.6.5"
#"Date: 17/2/25 12:31:07 pm"
#
#
#24
#log(Lalpha/ erg/s) log(phi)
41.3783 -1.81333 -1.88317 -1.76090
41.7751 -2.26863 -2.32977 -2.21621
42.1781 -2.26981 -2.39206 -2.18244
42.5522 -2.45430 -2.55909 -2.38440
42.5693 -2.58536 -2.88231 -2.42815
42.7477 -2.67321 -2.78678 -2.61208
42.9544 -3.12796 -3.32880 -2.97946
43.1501 -3.18967 -3.44297 -3.02371
17 changes: 17 additions & 0 deletions data/lf/Halpha/Ly_0.24.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
##H-alpha Luminosity Function from Ly et al. (2007)
#
#Dust extinction correction: yes
#H0= 70.0000
#Omega_M= 0.300000
#Omega_Lambda= 0.700000
#<z>= 0.240000
#[min(z),max(z)] 0.233000 0.251000
###########
#Log(L(Halpha) [erg s^-1]) dn/dLog(L) Error
39.2000 0.0776247 0.00000
39.6000 0.0234423 0.00500000
40.0000 0.0162181 -4.84288e-08
40.4000 0.0112202 -0.0150000
40.8000 0.00851138 -0.0150000
41.2000 0.00537032 -0.0300000
41.6000 0.000524807 -0.705000
17 changes: 17 additions & 0 deletions data/lf/Halpha/Ly_0.40.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
H-alpha Luminosity Function from Ly et al (2007)

Dust extinction correction: yes
H0= 70.0000
Omega_M= 0.300000
Omega_Lambda= 0.700000
<z>= 0.400000
[min(z),max(z)] 0.390000 0.410000
##########
Log(L(Halpha) [erg s^-1]) dn/dLog(L) Error
39.6000 0.0295121 0.00437232
40.0000 0.0151356 0.00184683
40.4000 0.0131826 0.00127183
40.8000 0.0104713 0.000748898
41.2000 0.00831764 0.00168236
41.6000 0.00288403 0.000831320
42.0000 0.00123027 0.000507532
19 changes: 19 additions & 0 deletions data/lf/Halpha/Ly_2010_z0p8.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#"log(phi)(log(LHalpha/erg/s)) created by Plot Digitizer 2.6.5"
#"Date: 16/2/25 8:59:20 pm"
#
#
#38
#log(LHalpha/erg/s) log(phi)
40.9000 -2.22393 -2.61368
41.1114 -1.60855 -1.73162
41.3057 -1.81368 -1.86154
41.5000 -1.97094 -2.01197
41.7000 -2.01880 -2.05983
41.9000 -2.17607 -2.22393
42.1000 -2.36068 -2.40171
42.3000 -2.47009 -2.51795
42.5057 -2.70940 -2.79145
42.7057 -2.90769 -3.00342
42.9057 -3.08547 -3.22222
43.1000 -3.48205 -3.70769
43.3000 -3.61197 -3.89231
8 changes: 8 additions & 0 deletions data/lf/Halpha/Sobral13.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Data from Sobral et al. (2013), MNRAS.428.1128S
#IMF adopted: Salpeter
#
#redshift SFRD[Msun/yr/Mpc^3] error_SFRD[Msun/yr/Mpc^3]
0.40 0.03 0.01
0.84 0.10 0.015
1.47 0.13 0.02
2.23 0.21 0.03
13 changes: 13 additions & 0 deletions data/lf/Halpha/Sobral13_z0.8.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#From David Sobral.
#Phi is in units of Mpc^-3 dex^-1.
#
# Bin_LogL_unc Bin_LogL_corr Delta_Bin N_sources Poiss_err Obs_Phi err_obs_phi Corr_Phi err_corr_phi Volume_top_hat
41.30 41.70 0.07 218 14 -2.12 0.03 -1.93 0.03 190995
41.45 41.85 0.07 222 14 -2.11 0.03 -2.02 0.03 190995
41.60 42.00 0.07 107 10 -2.43 0.04 -2.18 0.04 190995
41.75 42.15 0.07 54 7 -2.72 0.06 -2.43 0.06 190995
41.90 42.30 0.07 12 3 -3.38 0.15 -2.73 0.17 190995
42.05 42.45 0.07 10 3 -3.46 0.17 -3.01 0.17 190995
42.20 42.60 0.07 7 2 -3.61 0.21 -3.27 0.21 190995
42.35 42.75 0.07 2 1 -4.16 0.53 -3.79 0.55 190995
42.50 42.90 0.07 1 1 -4.46 0.90 -4.13 1.51 190995
17 changes: 17 additions & 0 deletions data/lf/Halpha/Sobral13_z1.4.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#From David Sobral.
#Phi is in units of Mpc^-3 dex^-1.
#
# Bin_LogL_unc Bin_LogL_corr Delta_Bin N_sources Poiss_err Obs_Phi err_obs_phi Corr_Phi err_corr_phi Volume_top_hat
41.70 42.10 0.05 25 5 -2.20 0.10 -2.13 0.10 39672
41.80 42.20 0.05 32 5 -2.37 0.08 -2.25 0.09 74989
41.90 42.30 0.05 62 7 -2.55 0.06 -2.34 0.06 220634
42.00 42.40 0.05 86 9 -2.67 0.05 -2.47 0.05 398674
42.10 42.50 0.05 101 10 -2.77 0.05 -2.61 0.05 596910
42.20 42.60 0.05 106 10 -2.82 0.04 -2.72 0.04 696841
42.30 42.70 0.05 43 6 -3.22 0.07 -2.90 0.08 713712
42.40 42.80 0.05 23 4 -3.49 0.10 -3.17 0.11 713712
42.50 42.90 0.05 9 3 -3.90 0.18 -3.54 0.18 713712
42.60 43.00 0.05 5 2 -4.16 0.26 -3.80 0.26 718959
42.70 43.10 0.05 3 1 -4.38 0.37 -4.21 0.38 718959
42.80 43.20 0.05 2 1 -4.56 0.53 -4.54 0.55 718959
43.00 43.40 0.10 2 1 -4.56 0.53 -4.85 0.55 718959
19 changes: 19 additions & 0 deletions data/lf/Halpha/Sobral13_z2.23.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#From David Sobral.
#Phi is in units of Mpc^-3 dex^-1.
#
# Bin_LogL_unc Bin_LogL_corr Delta_Bin N_sources Poiss_err Obs_Phi err_obs_phi Corr_Phi err_corr_phi Volume_top_hat
41.60 42.00 0.075 8 2 -2.18 0.19 -1.93 0.19 7989
41.75 42.15 0.075 11 3 -2.34 0.16 -2.07 0.16 15979
41.90 42.30 0.05 47 7 -2.24 0.07 -2.19 0.07 67000
42.00 42.40 0.05 91 9 -2.36 0.05 -2.31 0.05 209005
42.10 42.50 0.05 107 10 -2.48 0.04 -2.41 0.05 326701
42.20 42.60 0.05 158 12 -2.60 0.04 -2.50 0.04 633453
42.30 42.70 0.05 163 12 -2.68 0.04 -2.59 0.05 772174
42.40 42.80 0.05 100 10 -2.89 0.05 -2.73 0.06 772174
42.50 42.90 0.05 51 7 -3.18 0.07 -2.88 0.14 772174
42.60 43.00 0.05 30 5 -3.41 0.09 -3.09 0.17 772174
42.70 43.10 0.05 16 4 -3.68 0.12 -3.33 0.22 772174
42.80 43.20 0.05 7 2 -4.04 0.21 -3.67 0.31 772174
42.90 43.30 0.05 3 1 -4.41 0.37 -4.01 0.51 772174
43.00 43.40 0.05 2 1 -4.59 0.53 -4.22 0.68 772174
43.20 43.60 0.10 3 1 -4.41 0.37 -4.63 0.41 772174
14 changes: 14 additions & 0 deletions data/lf/Halpha/lf_jones01_z0.08
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
H-alpha Luminosity Function from Jones & Bland-Hawthorn (2001)

Dust extinction correction: no
H0= 50.0000
Omega_M= 1.00000
Omega_Lambda= 0.00000
<z>= 0.0800000
[min(z),max(z)] 0.0620000 0.0930000
##########
Log(L(Halpha) [erg s^-1]) dn/dLog(L) Error
39.5000 0.0151356 0.00481701
39.9000 0.0128825 0.00490030
40.3000 0.00676083 0.00371046
40.7000 0.00301995 0.00155093
14 changes: 14 additions & 0 deletions data/lf/Halpha/lf_jones01_z0.40
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
H-alpha Luminosity Function from Jones & Bland-Hawthorn (2001)

Dust extinction correction: no
H0= 50.0000
Omega_M= 1.00000
Omega_Lambda= 0.00000
<z>= 0.400000
[min(z),max(z)] 0.359000 0.411000
##########
Log(L(Halpha) [erg s^-1]) dn/dLog(L) Error
40.8000 0.00467735 0.00148860
41.2000 0.00398107 0.00126700
41.6000 0.00128825 0.000573838
42.0000 0.000144544 0.000164486
42 changes: 39 additions & 3 deletions optim/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,39 @@ def get_obs_x_y_err(self, h0):

return x_obs, y_obs, y_dn, y_up

class SMF_z3(SMF):
"""The SMF constraint at z=3"""

z = [3]

def get_obs_x_y_err(self, h0):

#SMF from Weaver et al. (2022)
lm, pD, dn, du = self.load_observation('mf/SMF/COSMOS2020/SMF_Farmer_v2.1_3.0z3.5_total.txt', cols = [0,2,3,4])
hobs = 0.7
y_obs = np.log10(pD) + 3.0 * np.log10(hobs/h0)
y_dn = np.log10(pD) - np.log10(dn)
y_up = np.log10(du) - np.log10(pD)
x_obs = lm - 2.0 * np.log10(hobs/h0)

return x_obs, y_obs, y_dn, y_up

class SMF_z4(SMF):
"""The SMF constraint at z=4"""

z = [4]

def get_obs_x_y_err(self, h0):

#SMF from Weaver et al. (2022)
lm, pD, dn, du = self.load_observation('mf/SMF/COSMOS2020/SMF_Farmer_v2.1_3.5z4.5_total.txt', cols = [0,2,3,4])
hobs = 0.7
y_obs = np.log10(pD) + 3.0 * np.log10(hobs/h0)
y_dn = np.log10(pD) - np.log10(dn)
y_up = np.log10(du) - np.log10(pD)
x_obs = lm - 2.0 * np.log10(hobs/h0)

return x_obs, y_obs, y_dn, y_up

class CSFR(Constraint):
"""The Cosmic Star Formation Rate constraint"""
Expand Down Expand Up @@ -574,10 +607,13 @@ def parse(spec):
_constraints = {
'HIMF': HIMF,
'SMF_z0': SMF_z0,
'SMF_z0p5': SMF_z0p5,
'SMF_z0p5': SMF_z0p5,
'SMF_z1': SMF_z1,
'CSFR': CSFR,
'RM': RM
'SMF_z2': SMF_z2,
'SMF_z3': SMF_z3,
'SMF_z4': SMF_z4,
'CSFR': CSFR,
'RM': RM
}

def _parse(s):
Expand Down
7 changes: 7 additions & 0 deletions standard_plots/bh.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ def prepare_data(hdf5_data, index, spinbh, spinmdot, mdotmbh, mdotmbh_hh, BHSFR,
BHSFR[index,:] = bin_it(x=np.log10(mbh[ind]) - np.log10(float(h0)),
y=np.log10(ssfr[ind]))

if(index == 5): #z=3
ind = np.where((mbh > 0) & (ssfr > 1e-14) & ((mbulge + mdisk)/h0 > 1e10) & (typeg <= 0))
sfrin = (sfr_disk[ind] + sfr_burst[ind]) / 1e9 / h0
msin = (mbulge[ind] + mdisk[ind])/h0
bhin = mbh[ind]
for a,b,c in zip(msin, sfrin, bhin):
print(a,b,c)

def plot_spine_BH(plt, outdir, obsdir, spinbh, spinmdot, mdotmbh):

Expand Down
12 changes: 7 additions & 5 deletions standard_plots/calculate_co_emission.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@

zsun = 0.0189

zlist = [0, 0.5, 1, 1.5, 2, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0]

def plot_co_sled(plt, LCO, snap, outdir):

xj = np.array([1,2,3,4,5,6,7,8,9,10])
Expand Down Expand Up @@ -300,21 +302,21 @@ def get_co_emissions(mmol, zcoldg, guv, fx):
hf.close()

if(test_co_sleds):
ssfr_cut = 10**(-1 + 0.5 * redshift)
ssfr_cut = 10**(-1 + 0.5 * zlist[index])
ind = np.where( ((mdisk + mbulge)/h0 > 1e10) & ((sfr_d + sfr_b)/(mdisk + mbulge) > ssfr_cut))
return LCOd[ind] + LCOb[ind]

def main(model_dir, output_dir, redshift_table, subvols, obs_dir):

plt = common.load_matplotlib()
test_co_sleds = False
test_co_sleds = True
read_spin = True

if(test_co_sleds):
zlist = [0, 0.5, 1, 1.5, 2, 2.5, 3.0]
zlist = [0] #, 0.5, 1, 1.5, 2, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0]
snapshots = redshift_table[zlist]
else:
snapshots = range(61,200)
snapshots = range(128,202)

# Loop over redshift and subvolumes
plt = common.load_matplotlib()
Expand All @@ -337,7 +339,7 @@ def main(model_dir, output_dir, redshift_table, subvols, obs_dir):
hdf5_data = common.read_data(model_dir, snapshot, fields, [subv])
if(test_co_sleds):
LCO = prepare_data(hdf5_data, index, model_dir, snapshot, subv, obs_dir, read_spin, test_co_sleds)
plot_co_sled(plt, LCO, str(zlist[index]), output_dir)
#plot_co_sled(plt, LCO, str(zlist[index]), output_dir)
else:
prepare_data(hdf5_data, index, model_dir, snapshot, subv, obs_dir, read_spin, test_co_sleds)

Expand Down
Loading

0 comments on commit 3e27181

Please sign in to comment.