Пример #1
0
def mf_obj(i):
    Ombh2, Omch2, w, ns, ln10As, H0, Neff, sig8 = AD.building_box_cosmologies(
    )[i]
    cosmo = {
        'Obh2': Ombh2,
        'Och2': Omch2,
        'w0': w,
        'n_s': ns,
        'ln10^{10}A_s': ln10As,
        'N_eff': Neff,
        'H0': H0
    }
    hmf = aemHMF.Aemulus_HMF()
    hmf.set_cosmology(cosmo)
    return hmf
Пример #2
0
def get_cosmo(i):
    obh2, och2, w, ns, ln10As, H0, Neff, s8 = AD.building_box_cosmologies()[i]
    aemcosmo={'Obh2':obh2, 'Och2':och2, 'w0':w, 'n_s':ns, 'ln10^{10}A_s':ln10As, 'N_eff':Neff, 'H0':H0}
    import aemHMF
    hmf = aemHMF.Aemulus_HMF()
    hmf.set_cosmology(aemcosmo)

    h = H0/100.
    Omega_b = obh2/h**2
    Omega_c = och2/h**2
    Omega_m = Omega_b+Omega_c
    params = {'output': 'mPk', 'h': h, 'ln10^{10}A_s': ln10As, 'n_s': ns, 'w0_fld': w, 'wa_fld': 0.0, 'Omega_b': Omega_b, 'Omega_cdm': Omega_c, 'Omega_Lambda': 1.- Omega_m, 'N_eff': Neff, 'P_k_max_1/Mpc':10., 'z_max_pk':10. }
    cosmo = Class()
    cosmo.set(params)
    cosmo.compute()
    return cosmo, h, Omega_m, hmf
            ximm[i] = (r2ximm_diff[i*self.Nr :(i+1)*self.Nr] + r2xinl[i])/self.radii**2
        #Return the full prediction
        return ximm

    def xi_mm_at_z(self, redshift, params=None):
        raise Exception("xi_mm at arbitrary redshift not implemented yet.")
        assert redshift >= 0, "Redshift must be >= 0."
        assert redshift <= 3, "Redshift must be <= 3."
        ximm = self.predict(params)
        return 0

    def get_radii(self):
        return self.radii

    def get_redshifts(self):
        return self.redshifts

if __name__=="__main__":
    import matplotlib.pyplot as plt
    import aemulus_data as AD
    #Test it
    test_ind = 0
    cos = AD.building_box_cosmologies()[test_ind]
    cos = np.delete(cos, -1) #remove sigma8
    emu = ximm_emulator(cos)
    ximm = emu.predict(cos)
    #xiz = emu.xi_mm_at_z(1)
    for i in range(Nz):
        plt.loglog(radii, radii**2*ximm[i])
    plt.show()