def deltac_z(z, Om=Om, Ol=1 - Om, mode=1): if mode == 0: deltac = deltac0 else: deltac = peaks.collapseOverdensity(corrections=True, z=z) Dz = Dgrow(z, Om, Ol) return deltac / Dz
def mass_function_rseppi(Mass): cosmo = cosmology.getCurrent() delta_c = peaks.collapseOverdensity(z=z) R = peaks.lagrangianR(Mass) sigma = cosmo.sigma(R=R, z=z) nu = delta_c / sigma nu2 = nu**2 zp1 = 1.0 + z A = 0.333 * zp1**-0.11 a = 0.788 * zp1**-0.01 p = 0.807 q = 1.795 f = A * np.sqrt(2 / np.pi) * np.exp( -a * nu2 * 0.5) * (1.0 + (nu2 * a)**-p) * (nu * np.sqrt(a))**q d_ln_sigma_d_ln_R = cosmo.sigma(R, z, derivative=True) rho_Mpc = cosmo.rho_m(0.0) * 1E9 mass_func_model = -1 / 3 * f * rho_Mpc / Mass * d_ln_sigma_d_ln_R return mass_func_model
t3=Table() peak_array_full = [] xoff_full = [] xoff_err_full = [] z_full = [] xoff_tot_full =[] for i, p2s in enumerate(path_2_snapshot_data): print('HMD') print(i,' of ', len(path_2_snapshot_data)) aexp = float(os.path.basename(p2s[:-8]).split('_')[1]) z_snap = 1/aexp -1 print('z=%.3g'%(z_snap)) E_z = cosmo.Ez(z=z_snap) Vol1 = (4e3/(1+z_snap))**3 dc = peaks.collapseOverdensity(z = z_snap) rho_m = cosmo.rho_m(z=z_snap)*1e9 hd1 = fits.open(p2s) mass1=hd1[1].data['Mvir'] logmass1 = np.log10(mass1) R_1 = peaks.lagrangianR(mass1) sigf_1 = cosmo.sigma(R_1,z=z_snap) log1_sigf_1 = np.log10(1/sigf_1) Rvir1 = hd1[1].data['Rvir'] Rs1 = hd1[1].data['Rs'] xoff_data1 = np.log10(hd1[1].data['Xoff']/hd1[1].data['Rvir']) spin1 = hd1[1].data['Spin'] spinpar1 = hd1[1].data['Spin_Bullock']
def seppi20(sigma, z, xoff=None, spin=None, int_sigma=False, int_xoff=True, int_spin=True): """ The mass function model of Seppi et al 2020. The model is specified in Equation 23. Calibrated for M > 4x10^13 Msun at z=0. Parameters ----------------------------------------------------------------------------------------------- sigma: array_like Variance; can be a number or an array. xoff: array_like Offset parameter; can be a number or array. spin: array_like Spin parameter; can be a number or an array. int_sigma: bool Boolean variable to integrate on sigma or not. int_xoff: bool Boolean variable to integrate on xoff or not. int_spin: bool Boolean variable to integrate on spin or not. Returns ----------------------------------------------------------------------------------------------- The output depends on which integrals the user chooses to perform. h: 3D meshgrid The halo mass-xoff-spin function :math:`h(\\sigma,xoff,\\lambda)` g_sigma_xoff: 2D meshgrid The halo mass-xoff function :math:`g(\\sigma,xoff)`, integrated on spin g_sigma_spin: 2D meshgrid The halo mass-spin function :math:`g(\\sigma,\\lambda)`, integrated on xoff g_xoff_spin: 2D meshgrid The halo xoff-spin function :math:`g(xoff,\\lambda)`, integrated on mass f_xoff: array_like The halo xoff function :math:`f(xoff)`, integrated on mass and spin. f_spin: array_like The halo spin function :math:`f(\\sigma)`, integrated on mass and xoff. f: array_like The halo mass function :math:`f(\\sigma)`, integrated on xoff and spin. """ zp1 = 1 + z dc = peaks.collapseOverdensity(z=0) A = -22.004 * (zp1)**-0.0441 a = 0.886 * (zp1)**-0.1611 q = 2.285 * (zp1)**0.0409 mu = -3.326 * (zp1)**-0.1286 alpha = 5.623 * (zp1)**0.1081 beta = -0.391 * (zp1)**-0.3114 gamma = 3.024 * (zp1)**0.0902 delta = 1.209 * (zp1)**-0.0768 e = -1.105 * (zp1)**0.6123 if sigma is None: sigma = np.linspace(0.25, 1.2, 50) if xoff is None: xoff = np.logspace(-3.5, -0.3, 50) if spin is None: spin = np.logspace(-3.5, -0.3, 50) sigma_, xoff_, spin_ = np.meshgrid(sigma, xoff, spin, indexing='ij') h_log = A + np.log10(np.sqrt(2 / np.pi)) + q * np.log10( np.sqrt(a) * dc / sigma_) - a / 2 / np.log(10) * dc**2 / sigma_**2 + ( alpha) * np.log10(xoff_ / 10**(1.83 * mu)) - 1 / np.log(10) * ( xoff_ / 10**(1.83 * mu))**(0.05 * alpha) + gamma * np.log10( spin_ / (10**(mu))) - 1 / np.log(10) * (xoff_ / 10**( 1.83 * mu) / sigma_**e)**(beta) * (spin_ / (10**(mu)))**(delta) h = 10**h_log #compute 2D distributions g_xoff_spin = np.zeros((len(xoff), len(spin))) for i in range(len(xoff)): for j in range(len(spin)): if len(sigma) == 1: g_xoff_spin[i, j] = h[:, i, j] else: g_xoff_spin[i, j] = integrate.simps(h[:, i, j], sigma) g_sigma_spin = np.zeros((len(sigma), len(spin))) for i in range(len(sigma)): for j in range(len(spin)): if len(xoff) == 1: g_sigma_spin[i, j] = h[i, :, j] else: g_sigma_spin[i, j] = integrate.simps(h[i, :, j], np.log10(xoff)) g_sigma_xoff = np.zeros((len(sigma), len(xoff))) for i in range(len(sigma)): for j in range(len(xoff)): if len(spin) == 1: g_sigma_xoff[i, j] = h[i, j, :] else: g_sigma_xoff[i, j] = integrate.simps(h[i, j, :], np.log10(spin)) #compute 1D distributions f_xoff = np.zeros(len(xoff)) for i in range(len(xoff)): if len(sigma) == 1: f_xoff[i] = g_sigma_xoff[:, i] else: f_xoff[i] = integrate.simps(g_sigma_xoff[:, i], np.log10(1 / sigma)) f_spin = np.zeros(len(spin)) for i in range(len(spin)): if len(sigma) == 1: f_spin[i] = g_sigma_spin[:, i] else: f_spin[i] = integrate.simps(g_sigma_spin[:, i], np.log10(1 / sigma)) f_sigma = np.zeros(len(sigma)) for i in range(len(sigma)): if len(xoff) == 1: f_sigma[i] = g_sigma_xoff[i, :] else: f_sigma[i] = integrate.simps(g_sigma_xoff[i, :], np.log10(xoff)) if (int_sigma == False) & (int_xoff == False) & (int_spin == False): return h if (int_sigma == True) & (int_xoff == False) & (int_spin == False): return g_xoff_spin if (int_sigma == False) & (int_xoff == True) & (int_spin == False): return g_sigma_spin if (int_sigma == False) & (int_xoff == False) & (int_spin == True): return g_sigma_xoff if (int_sigma == True) & (int_xoff == True) & (int_spin == False): return f_spin if (int_sigma == True) & (int_xoff == False) & (int_spin == True): return f_xoff if (int_sigma == False) & (int_xoff == True) & (int_spin == True): return f_sigma
def Dgrow_(z, Om=Om, Ol=1 - Om): return delta_plus(z, Om, Ol) / delta_plus0 def Dgrow(z, Om=Om, Ol=1 - Om): Omz = Om * (1 + z)**3 / (Om * (1 + z)**3 + Ol) Olz = 1 - Omz gz = 2.5 * Omz * (Omz**(4 / 7) - Olz + (1 + Omz / 2) * (1 + Olz / 70))**-1 gz0 = 2.5 * Om * (Om**(4 / 7) - Ol + (1 + Om / 2) * (1 + Ol / 70))**-1 return gz / (1 + z) / gz0 from colossus.lss import peaks deltac0 = peaks.collapseOverdensity(corrections=True, z=0) def deltac_z(z, Om=Om, Ol=1 - Om, mode=1): if mode == 0: deltac = deltac0 else: deltac = peaks.collapseOverdensity(corrections=True, z=z) Dz = Dgrow(z, Om, Ol) return deltac / Dz lz = np.linspace(0, 50, 200) d = Om * (1 + lz)**3 / (1 - Om + Om * (1 + lz)**3) - 1 do = 18 * np.pi**2 + 82 * d - 39 * d**2 plt.figure()
from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from scipy.optimize import curve_fit import ultranest from ultranest.plot import cornerplot import corner import pandas as pd import hydro_mc import random print('Looks for correlation between Xray center-BCG displacement with Xoff') print('------------------------------------------------') print('------------------------------------------------') #set cosmology cosmo = cosmology.setCosmology('multidark-planck') dc = peaks.collapseOverdensity(z=0) h = cosmo.Hz(z=0) / 100 cosmo_astropy = FlatLambdaCDM(H0=67.77, Om0=0.307) direct = '.' path_2_BCG = os.path.join(direct, 'SpidersXclusterBCGs-v2.0.fits') path_2_clusters = os.path.join(direct, 'catCluster-SPIDERS_RASS_CLUS-v3.0.fits') #path_2_bcg_eFEDS = os.path.join(direct, 'BCG_eFEDS.fits') #path_2_clusters_eFEDS = os.path.join(direct,'eFEDS_properties_18_3_2020.fits') path_2_clusters_eFEDS = os.path.join( direct, 'wcen', 'decals_dr8_run_32_efeds_extendedSourceCatalog_mllist_ph_22_11_2019_v940_final_catalog.fit' ) #path_2_model = os.path.join('..','quarantine','HMF','g_sigma','coeff','HMD','z_0.000','model.fit') path_2_model = os.path.join('..', 'quarantine', 'gsigma', 'extended', '3d',