Omega_b h^2 = 0.0220 Dark cold matter density: Omega_c h^2 = 0.1199 Spectral index n_s = 0.9693 Hubble constant: H_0 = 67.3 km s^-1 Mpc ^-1 Matter density: Omega_m = 0.315 Optical depth tau = 0.089 """ # <codecell> pert_object = Perturbations(M,z=1.0) pert_object.update(omegab = 0.05) print "Transfer Cosmo" print pert_object._transfer_cosmo print "Extra Cosmo" print pert_object._extra_cosmo print "Cosmo Params" print pert_object.cosmo_params # <codecell> #kwargs = {'sigma_8':0.9} #kwargs = {'z':6.0, 'sigma_8'} #pert_object.update(**kwargs)
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> from hmf import Perturbations import numpy as np M = np.arange(10,15,0.01) pert_object = Perturbations(M,z=0.0) """ PLANCK PARAMETERS (mar-2013) Angular size of sound horizon at recombination theta_* = (1.0414)*10^-2 Baryons density: Omega_b h^2 = 0.0220 Omega_b = 0.0486 Dark cold matter density: Omega_c h^2 = 0.1199 Omega_c = 0.2647 Spectral index n_s = 0.9693 Hubble constant: H_0 = 67.3 km s^-1 Mpc ^-1 h = 0.67.3 Matter density: Omega_m = 0.315 Optical depth tau = 0.089 """ # <codecell>
#plt.savefig(directory + 'sigma.eps') #=============================================================================== # fsigma and fsigma (Compare) one on the other #=============================================================================== plt.clf() M = np.linspace(10, 15, 501) fig = plt.figure(figsize=(12 * 1.2, 7.0 * 1.2)) gs = gridspec.GridSpec(2, 1, height_ratios=[2, 1]) ax = [plt.subplot(gs[1])] ax.insert(0, plt.subplot(gs[0], sharex=ax[0])) ax[0].grid(True) ax[1].grid(True) pert = Perturbations(M) vfv_ST = pert.fsigma approaches = [ 'PS', 'ST', 'Jenkins', 'Reed03', 'Warren', 'Reed07', 'Tinker', 'Crocce', 'Courtin', 'Bhattacharya', 'Angulo', 'Angulo_Bound', 'Watson_FoF', 'Watson', "Peacock", "Behroozi" ] lines = ["-", "--", "-.", ":"] ax[1].set_xlabel(xlab) ax[0].set_ylabel(r'Fraction of Mass Collapsed, $f(\sigma)$') ax[1].set_ylabel(r'$f(\sigma)/f_{\rm ST}(\sigma)$') for i, approach in enumerate(approaches): pert.update(mf_fit=approach) ax[0].plot(10**M,
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> from hmf import Perturbations import numpy as np M = np.arange(10,15,0.01) pert_object = Perturbations(M,z=6.0) object_mass_func = pert_object.dndlnm #Output: #WARNING: Unrecognized parameters: #transfer__kmax #transfer__k_per_logint # <codecell> #""" #PLANCK PARAMETERS (mar-2013) #Angular size of sound horizon at recombination # theta_* = (1.0414)*10^-2 #Baryons density: # Omega_b h^2 = 0.0220 # Omega_b = 0.0486 #Dark cold matter density: # Omega_c h^2 = 0.1199 # Omega_c = 0.2647 #Spectral index # n_s = 0.9693 #Hubble constant:
''' This script explores the projected differences between using an EH and CAMB transfer function. ''' from hmf import Perturbations import time import numpy as np omegab = [0.02, 0.05, 0.1] omegac = [0.2, 0.25, 0.5] H0 = [50, 70, 90] n = [0.8, 0.9, 1.0] pert_camb = Perturbations(transfer_fit="CAMB") pert_EH = Perturbations(transfer_fit="EH") camb_time = 0.0 eh_time = 0.0 for ob in omegab: for oc in omegac: for h in H0: for nn in n: pert_camb.update(omegab=ob, omegac=oc, H0=h, n=nn) pert_EH.update(omegab=ob, omegac=oc, H0=h, n=nn) start = time.time() camb = pert_camb.dndm camb_time += time.time() - start start = time.time() eh = pert_EH.dndm
import time redshifts = [0.0, 1.0] fits = ["ST", "PS"] s8s = [0.8, 0.9] omegavs = [0.7, 0.6] #=============================================================================== # Do hmf first #=============================================================================== # First do a "fair" comparison of a single calculation start = time.time() pert = Perturbations(M=np.linspace(3, 17, 1401), k_bounds=np.exp([-21, 21]), omegav=0.7, omegab=0.05, omegac=0.25, H0=70.0, n=1.0, sigma_8=0.8) #pert.dndlnm pert.ngtm time_hmf_1 = time.time() - start #Now do a comparison of 2 redshifts, 2 fitting functions, 2 sigma_8s and 2 cosmos start = time.time() pert = Perturbations(M=np.linspace(3, 17, 1401), k_bounds=np.exp([-21, 21]), omegav=0.7, omegab=0.05,