コード例 #1
0
def desi_elg(zee, force=False):
    zee = np.asarray(zee)
    aa = 1. / (1. + zee)

    if force:
        return 0.84 / growth_factor(aa)

    if np.any(zee > 1.8):
        raise ValueError(
            '\n\nCalling b(z) outside range of ELGs (z < 1.8).\n\n')

    return 0.84 / growth_factor(aa)
コード例 #2
0
def desi_qso(zee, force=False):
    zee = np.asarray(zee)
    aa = 1. / (1. + zee)

    if force:
        return 1.20 / growth_factor(aa)

    if np.any(zee > 5.0):
        raise ValueError(
            '\n\nCalling b(z) outside range of QSOs (z < 5.0).\n\n')

    return 1.20 / growth_factor(aa)
コード例 #3
0
def desi_lrg(zee, force=False):
    zee = np.asarray(zee)
    aa = 1. / (1. + zee)

    if force:
        return 1.70 / growth_factor(aa)

    if np.any(zee > 1.3):
        raise ValueError(
            '\n\nCalling b(z) outside range of LRGs (z < 1.3).\n\n')

    return 1.70 / growth_factor(aa)
コード例 #4
0
def desi_bgs(zee, force=False):
    zee = np.asarray(zee)
    aa = 1. / (1. + zee)

    if force:
        return 1.34 / growth_factor(aa)

    if np.any(zee > 0.5):
        raise ValueError(
            '\n\nCalling b(z) outside range of BGS (z < 0.5).\n\n')

    return 1.34 / growth_factor(aa)
コード例 #5
0
ファイル: tinker.py プロジェクト: michaelJwilson/LBGCMB
def tinker_sigma(Pk_interps, Ms, z):
    ## Beware variable definitions wrt massfn.py, which is based upon https://arxiv.org/pdf/1005.2239.pdf
    result = []

    ## Lift Martin's linear z=0 P(k).
    data = np.loadtxt('../dat/pklin_1.0000.txt')
    PMW = interp1d(data[:, 0],
                   data[:, 1],
                   kind='linear',
                   copy=True,
                   bounds_error=False,
                   fill_value=0.0,
                   assume_sorted=False)

    for M in Ms:
        ## Implicitly a fn. of z by rho_b, Pmm and the growth factor.
        ks = np.arange(1.e-3, 1.e1, 1.e-3)

        Rms = (3. * M / 4 / np.pi / rho_b)**(1. / 3.)

        ## Ps     = Pmm(Pk_interps, ks, 0.0, type='linear')
        Ps = PMW(ks)

        Ws = W(ks * Rms)

        ## Defined by linear or non-linear.
        integrand = ks * ks * Ps * Ws

        sig = simps(integrand, dx=ks[1] - ks[0])
        sig *= growth_factor(z)

        result.append(sig)

    return np.array(result)
コード例 #6
0
ファイル: pmh.py プロジェクト: michaelJwilson/LBGCMB
def Pmm(Pk_interps, k, z, type='nlinear'):
    ##  Required to take an array of k values, and float argument for z.
    a = 1. / (1. + z)

    if (type == 'lpt') & (z >= 1.) & (z <= 3.5):
        ## print("\n\nAssuming LPT parameters of Modi++ for Pmm prediction within (1. < z < 3.5)")

        bestfitz = rround(z)
        alpha = modi_hbias[bestfitz]['amm']

        Ploop = Pk_interps['PA'](k) + Pk_interps['PW'](k)

        result = (1 - alpha * k * k / 2.) * Pk_interps['PZ'](k) + Ploop

        ## result[kmax > 3.0]                      ## Impose kmax cut on LPT predictions.
        result *= growth_factor(a)**2.  ## Growth factor is exact in redshift.

    elif type == 'linear':
        ## print("\n\nAssuming CAMB linear matter power spectrum.")
        result = Pk_interps['camb_lin'](z, k)

    elif type == 'nlinear':
        ## print("\n\nAssuming CAMB non-linear matter power spectrum.")
        result = Pk_interps['camb_nlin'](z, k)

    else:
        raise ValueError('Type %s not available for Pmm.' % type)

    return result
コード例 #7
0
def sigma(Pk_interps, Ms, z):
    result = []

    ## Lift Martin's linear z=0 P(k).
    data = np.loadtxt('../dat/pklin_1.0000.txt')
    PMW = interp1d(data[:, 0],
                   data[:, 1],
                   kind='linear',
                   copy=True,
                   bounds_error=False,
                   fill_value=0.0,
                   assume_sorted=False)

    for M in Ms:
        ## Implicitly a fn. of z by rho_b, Pmm and the growth factor.
        ks = np.arange(1.e-3, 1.e1, 1.e-3)
        Rms = (3. * M / 4 / np.pi / rho_b)**(1. / 3.)

        ## Ps     = Pmm(Pk_interps, ks, 0.0, type='linear')
        Ps = PMW(ks)

        Ws = W(ks * Rms)

        ## Defined by linear or non-linear.
        integrand = ks * ks * Ps * Ws * Ws

        sig2 = simps(integrand, dx=ks[1] - ks[0])

        sig2 *= growth_factor(z)**2.
        sig2 /= (2. * np.pi**2.)

        result.append(np.sqrt(sig2))

    return np.array(result)
コード例 #8
0
ファイル: pmh.py プロジェクト: michaelJwilson/LBGCMB
def Phh(Pk_interps, k, z, scross=0.0):
    ##  Required to take an array of k values, and float argument for z.
    a = 1. / (1. + z)

    ## Round provided z to the nearest for which a bias value is available.
    bestfitz = rround(z)

    if biastype == 'Modi':
        if (bestfitz >= 1.) & (bestfitz <= 3.5):
            alpha = biasdict[bestfitz]['ahm']

            b1 = biasdict[bestfitz]['b1']
            b2 = biasdict[bestfitz]['b2']
            bs2 = biasdict[bestfitz]['bs']

            bD2 = 0.

            Ploop = Pk_interps['PA'](k) + Pk_interps['PW'](k)

            ## b2*b2*Pk_interps['Pd2d2'](k): incorrect normalisation, needs divided by four on input.
            result = (1 - alpha * k * k / 2.) * Pk_interps['PZ'](
                k) + Ploop + b1 * Pk_interps['Pd'](k) + b1**2. * Pk_interps[
                    'Pdd'](k) + b2 * Pk_interps['Pd2'](k)
            result += b1 * b2 * Pk_interps['Pdd2'](k) + b2 * b2 * Pk_interps[
                'Pd2d2'](k) + bs2 * Pk_interps['Ps2'](
                    k) + b1 * bs2 * Pk_interps['Pds2'](k)
            result += b2 * bs2 * Pk_interps['Pd2s2'](
                k) + bs2 * bs2 * Pk_interps['Ps2s2'](k) + 2 * bD2 * Pk_interps[
                    'PD2d'](k) + 2 * b1 * bD2 * Pk_interps['PdD2d'](k)

            ## result[kmax > 3.0]                     ## Impose kmax cut on LPT predictions.

            ## NOTE: Cannot simply scale by D+^2.
            result *= growth_factor(
                a)**2.  ## Growth factor is exact in redshift.

        else:
            result = Pk_interps['camb_nlin'](
                z,
                k)  ## For z < 1. and z > 3.5, replace with CAMB SPT results.

    elif biastype == 'dropouts':
        b1 = biasdict[bestfitz][
            'b1']  ## Stored Lagrangian bias, Eulerian is (1. + b1).
        result = (1. + b1) * (1. + b1) * Pk_interps['camb_nlin'](z, k)

    elif biastype == 'linz':
        result = (1. + z) * (1. + z) * Pk_interps['camb_nlin'](z, k)

    else:
        raise ValueError("Type is not available for Pmm.")

    return result
コード例 #9
0
ファイル: pmh.py プロジェクト: michaelJwilson/LBGCMB
def Pmh(Pk_interps, k, z, scross=0.):
    ##  Required to take an array of k values and float argument for z.
    a = 1. / (1. + z)
    bestfitz = rround(z)

    if biastype == 'Modi':
        if (bestfitz >= 1.) & (bestfitz <= 3.5):
            alpha = biasdict[bestfitz]['ahm']
            b1 = biasdict[bestfitz]['b1']
            b2 = biasdict[bestfitz]['b2']
            bs2 = biasdict[bestfitz]['bs']
            bD2 = 0.0

            Ploop = Pk_interps['PA'](k) + Pk_interps['PW'](k)

            ## Read in
            result = (1 - alpha * k * k / 2.) * Pk_interps['PZ'](k) + Ploop + (
                b1 / 2.) * Pk_interps['Pdd'](k) + (b2 / 2.) * Pk_interps[
                    'Pd2d2'](k) + (bs2 / 2.) * Pk_interps['Ps2'](k)
            result += bD2 * Pk_interps['PD2d'](k) + scross

            ## result[kmax > 3.0] = 0.0               ## Impose kmax cut on LPT predictions.

            ## NOTE: Cannot simply scale by D+^2.
            result *= growth_factor(
                a)**2.  ## Growth factor is exact in redshift.

        else:
            result = Pk_interps['camb_nlin'](
                z,
                k)  ## For z < 1. and z > 3.5, replace with CAMB SPT results.

    elif biastype == 'dropouts':
        b1 = biasdict[bestfitz]['b1']
        result = (1. + b1) * Pk_interps['camb_nlin'](z, k)

    elif biastype == 'linz':
        result = (1. + z) * Pk_interps['camb_nlin'](z, k)

    else:
        raise ValueError("Type is not available for Pmm.")

    return result
コード例 #10
0
ファイル: prep_pk.py プロジェクト: michaelJwilson/LBGCMB
def prep_pk(z):
  try:
    ks, Ps = np.loadtxt('dat/pk.dat', unpack=True)

  except:
    ##  Prepare pycamb module; linear, non-linear matter P(k) and Cls.                                                                                     
    cambx       =  CAMB()
    Pk_interps  =  get_PkInterps(cambx)

    ##  Write Linear power spectrum.                                                                                                                     
    ks = np.arange(0.01, 1., 0.01)
    Ps = Pk_interps['camb_lin'](0.0, ks)

    np.savetxt('dat/pk.dat', np.c_[ks, Ps])

  aa = 1. / (1. + z)
  dd = growth_factor(aa)

  return  ks, dd * dd * Ps
コード例 #11
0
ファイル: cadence.py プロジェクト: michaelJwilson/LBGCMB
def lenses_bz(zee):
    aa = 1. / (1. + zee)

    return 0.95 / growth_factor(aa)
コード例 #12
0
def lrg_bz(zz):
    aa = 1. / (1. + zz)
    Dp = growth_factor(aa)

    return 1.7 / Dp
コード例 #13
0
def qso_bz(zz):
    aa = 1. / (1. + zz)
    Dp = growth_factor(aa)

    return 1.2 / Dp
コード例 #14
0
def bgs_bz(zz):
    aa = 1. / (1. + zz)
    Dp = growth_factor(aa)

    return 1.0 / Dp
コード例 #15
0
def elg_bz(zz):
    aa = 1. / (1. + zz)
    Dp = growth_factor(aa)

    return 0.84 / Dp
コード例 #16
0
ファイル: pmh.py プロジェクト: michaelJwilson/LBGCMB
def invG_bz(z):
  return  1. / growth_factor(z)
コード例 #17
0
ファイル: get_bz.py プロジェクト: michaelJwilson/LBGCMB
def bz_fitmodel(z, A, B):
  aa = 1. / (1. + z)
  DD = growth_factor(aa)

  return  A / aa + B / aa**2.
コード例 #18
0
ファイル: plot_bz.py プロジェクト: michaelJwilson/LBGCMB
##
pl.scatter(har[:, 0], har[:, 1], c='b', marker='^', label='24.0', s=14)
pl.scatter(har[:, 0], har[:, 2], c='orange', marker='^', label='', s=14)
pl.scatter(har[:, 0], har[:, 3], c='c', marker='^', label='', s=14)
pl.scatter(har[:, 0], har[:, 4], c='y', marker='^', label='', s=14)

##
pl.scatter(cars[:, 0], cars[:, 1], c='orange', marker='s', label='24.5', s=14)
pl.scatter(cars[:, 0], cars[:, 2], c='c', marker='s', label='25.0', s=14)
pl.scatter(cars[:-1, 0], cars[:-1, 3], c='y', marker='s', label='25.5', s=14)

pl.xlim(2.90, 5.10)
pl.ylim(1.75, 9.75)

pl.xlabel(r'$z$')
pl.ylabel(r'$b(z)$')

pl.legend(loc=2, ncol=2, handletextpad=.05, frameon=False)

plt.tight_layout()

zs = np.arange(2.5, 6.0, 0.01)
aa = 1. / (1. + zs)
gs = growth_factor(aa)

pl.plot(zs, 0.3 / (gs**1.9), 'k-')
##  pl.plot(zs, 0.2 * (1. + zs) ** 2., 'r-')

pl.show()
##  pl.savefig('bz.pdf')
コード例 #19
0
    pl.xlim(3.0, 0.0)
    pl.ylim(0.0, 3.50e3)

    pl.xlabel(r'$z_{\rm{max}}$')
    pl.ylabel(r'$N(< z_{\rm{max}}) \ \ [\rm{gals. \ / \ deg^2}]$')

    ##  Second b(z) axis.
    ax = pl.gca()
    axx = ax.twinx()

    ##  LSST sources
    ##  biases.append(lambda z: 1. + z)

    ##  LSST lenses
    biases.append(lambda z: 0.95 / growth_factor(1. / (1. + z)))

    biases.append(mean_bias)

    zmaxes.append(3.5)  ## LSST bias limit
    zmaxes.append(3.5)  ## DESI mean bias limit

    for i, (bz, zmax) in enumerate(zip(biases, zmaxes)):
        axx.plot(zs[zs < zmax],
                 bz(zs[zs < zmax]),
                 c=colors[i],
                 alpha=0.45,
                 dashes=[3, 1],
                 label='')

    axx.set_ylabel(r'$b(z)$')