Ejemplo n.º 1
0
def test_mmax_big():
    #raises ValueError because ngtm=0 exactly at m=18
    #due to hard limit of integration in integrate_hmf.
    np.random.seed(12345)
    m,h = sample_mf(1e5,11,transfer_model="EH",Mmax=18)
    #centres,hist = dndm_from_sample(m,1e5/h.ngtm[0])
    #print centres,hist
    assert_raises(ValueError,dndm_from_sample,m,1e5/h.ngtm[0])
Ejemplo n.º 2
0
def test_mmax_big():
    #raises ValueError because ngtm=0 exactly at m=18
    #due to hard limit of integration in integrate_hmf.
    np.random.seed(12345)
    m, h = sample_mf(1e5, 11, transfer_model="EH", Mmax=18)
    #centres,hist = dndm_from_sample(m,1e5/h.ngtm[0])
    #print centres,hist
    assert_raises(ValueError, dndm_from_sample, m, 1e5 / h.ngtm[0])
Ejemplo n.º 3
0
def test_circular():
    np.random.seed(1234)
    m,h = sample_mf(1e5,11,transfer_model="EH")
    centres,hist = dndm_from_sample(m,1e5/h.ngtm[0])

    s = spline(np.log10(h.m),np.log10(h.dndm))

    print hist, 10**s(centres)
    assert np.allclose(hist,10**s(centres),rtol=0.05)
Ejemplo n.º 4
0
def test_circular():
    np.random.seed(1234)
    m, h = sample_mf(1e5, 11, transfer_model="EH")
    centres, hist = dndm_from_sample(m, 1e5 / h.ngtm[0])

    s = spline(np.log10(h.m), np.log10(h.dndm))

    print(hist, 10**s(centres))
    assert np.allclose(hist, 10**s(centres), rtol=0.05)
Ejemplo n.º 5
0
from slap import LAEModel

# Parameters
z = 7.3  # redshift
t_igm = 0.15  # toy IGM transmission fraction
delta_t = 50  # duty cycle parameter
rew_min = 0  # observational minimum Lya REW
lya_min = 2.4e42  # observational minimum Lya luminosity
vol = 1.0e7  # comoving mock survey volume Mpc^3
smallh = 0.678  # dimensionless Hubble parameter

# Create halo population in vol, using SMT halo function
hmf = MassFunction(hmf_model="SMT")
n_halo = int(smallh**3 * vol * np.trapz(x=hmf.m, y=hmf.dndm))
print("\nGenerating", n_halo, "halos in parent population")
halo_mass, _ = sample_mf(n_halo, 10, z=z, hmf_model="SMT")
print("Halo mass: min = {:.1e}, max = {:.1e} Msun/h".format(
    halo_mass.min(), halo_mass.max()))
halo_mass /= smallh  # Msun

# Generate LAE population from halo population
lae_pop = LAEModel(z, delta_t, halo_mass, rew_min, lya_min)
n_LAE = lae_pop.lya_lum.size
print(n_LAE, "LAEs generated.")

# Simulated luminosity function (intrinsic)
lf, edges = np.histogram(np.log10(lae_pop.lya_lum), bins=10)
dl = np.diff(edges)
lf = lf / dl / vol
lbins = 0.5 * (edges[1:] + edges[:-1])
lbins = 10**lbins