def _Cl_exact(self): ''' Angular power spectrum evaluated using full, exact integrals ''' z = np.linspace(self.z1, self.z2, self.nz_Cl) if hasattr(z, 'value'): z = z.value r = (self.h.cosmo.comoving_distance(z).to(u.Mpc)).value kmin = 1e-4 / u.Mpc kmax = 1 / u.Mpc self.mCl.update(kmin=kmin / 2., kmax=kmax * 2.) k = (ulogspace(kmin, kmax, self.nk_Cl).to(1 / u.Mpc)).value Pf = interp1d(self.mCl.k.value, self.mCl.Pk.value)(k) pool = multiprocessing.Pool(processes=self.processes) iterfun = partial(self._Cl_iter, k, r, Pf) C = pool.map(iterfun, self.l) pool.close() pool.join() return C * self.Tmean.unit**2
def dndM(self): ''' Halo mass function, note the need to convert from 1/h units in the output of pylians Interpolation done in log space ''' kh, P = self.Pm_for_HMF #mass vector for pylians Mvec = (ulogspace(self.Mmin.to(self.Msunh), self.Mmax.to(self.Msunh), 256)).to(self.Msunh) #Compute Halo mass function mf = MFL.MF_theory(kh, P, self.camb_pars.omegam, Mvec.value, self.hmf_model, z=self.z) d = (log_interp1d(Mvec.value, mf)(self.M.to(self.Msunh).value) * self.Mpch**-3 * self.Msunh**-1).to(self.Mpch**-3 * self.Msunh**-1) return d.to(u.Mpc**-3 * u.Msun**-1)
def k_edge(self): ''' Wavenumber bin edges ''' if self.linear_k: return np.linspace(self.kmin.value, self.kmax.value, self.nk + 1) * self.kmin.unit else: return ulogspace(self.kmin, self.kmax, self.nk + 1)
def k_edge(self): ''' Wavenumber bin edges ''' if self.k_kind == 'log': return ulogspace(self.kmin, self.kmax, self.nk + 1) elif self.k_kind == 'linear': return ulinspace(self.kmin, self.kmax, self.nk + 1) else: raise Exception('Invalid value of k_kind. Choose between\ linear or log')
def Tedge_i(self): ''' Edges of histogram bins ''' if self.linear_bin: Te = np.linspace(-self.Tmax,self.Tmax,self.Nbin_hist+1) else: Te = ulogspace(self.Tmin,self.Tmax,self.Nbin_hist+1) if self.subtract_mean: return Te-self.Tmean else: return Te
def M(self): ''' List of masses for computing mass functions and related quantities ''' # Make sure masses fall within bounds defined for hmf logMmin_h = np.log10((self.Mmin.to(self.Msunh)).value) logMmax_h = np.log10((self.Mmax.to(self.Msunh)).value) if logMmin_h < hmf_logMmin: self.h.update(Mmin=logMmin_h / 2.) elif logMmax_h > hmf_logMmax: self.h.update(Mmax=logMmax_h * 2.) return ulogspace(self.Mmin, self.Mmax, self.nM)
def Tedge(self): ''' Edges of intensity bins. Uses linearly spaced bins if do_fast=True, logarithmically spaced if do_fast=False ''' if self.do_fast: Te = np.linspace(self.Tmin,self.Tmax,self.nT+1) else: Te = ulogspace(self.Tmin,self.Tmax,self.nT+1) if self.subtract_mean: return Te-self.Tmean else: return Te
def Tedge_i(self): ''' Edges of histogram bins ''' if self.linear_VID_bin: Te = np.linspace(-self.Tmax_VID, self.Tmax_VID, self.Nbin_hist + 1) else: Tmin = self.T[self.T > 0].min() Te = ulogspace(Tmin, self.Tmax_VID, self.Nbin_hist + 1) if self.subtract_VID_mean: return Te - self.Tmean else: return Te
def sigmaM(self): ''' Mass variance at targed redshift, computed using pylians ''' kh, P = self.Pm_for_HMF #mass vector for pylians Mvec = (ulogspace(self.Mmin.to(self.Msunh), self.Mmax.to(self.Msunh), 256)).to(self.Msunh) #pylians get sigma(R). Get R rho_crit = 2.77536627e11 * (self.Msunh * self.Mpch**-3).to( self.Msunh * self.Mpch**-3) #h^2 Msun/Mpc^3 rhoM = rho_crit * self.camb_pars.omegam R = (3.0 * Mvec / (4.0 * np.pi * rhoM))**(1.0 / 3.0) #Get sigma(M) from pylians sigma_vec = np.zeros(len(R)) for ir in range(0, len(R)): sigma_vec[ir] = MFL.sigma(kh, P, R[ir].value) Mh = (self.M.to(self.Msunh)).value return log_interp1d(Mvec.value, sigma_vec)(Mh)
def L(self): ''' List of luminosities for computing luminosity functions and related quantities. ''' return ulogspace(self.Lmin, self.Lmax, self.nL)
def k_edge(self): ''' Wavenumber bin edges ''' return ulogspace(self.kmin, self.kmax, self.nk + 1)