示例#1
0
	def __init__(self,
				 z,
				 k,
				 mu,
				 k_par,
				 k_perp,
				 code = 'camb',
				 BAO_smearing = False,
				 cosmology = cc.cosmo()):

		# Initialize galaxy parameters
		gc.galaxy.__init__(self,
						   z = z,
						   k = k,
						   code = code,
						   BAO_smearing = BAO_smearing,
						   cosmology = cosmology)


		# Initialize RSD parameters
		self.mu      = mu
		self.k_par   = k_par
		self.k_perp  = k_perp

		self.nmu     = len(np.atleast_1d(mu))
		self.nk_par  = len(np.atleast_1d(k_par))
		self.nk_perp = len(np.atleast_1d(k_perp))

		# Initialize RSD galaxy power spectrum
		self.Pk['galaxies']['redshift space'] = {}
示例#2
0
    def __init__(self,
                 z,
                 k,
                 code='camb',
                 BAO_smearing=False,
                 cosmology=cc.cosmo()):

        # Reading all cosmological parameters
        self.cosmology = cosmology

        # Code
        self.code = code

        # Smear BAO in non-linearities
        self.BAO_smearing = BAO_smearing

        # Overdensity spherical collapse
        self.delta_sc = 3. / 20. * (12. * np.pi)**(2. / 3.)

        # Redshift and scales at which all must be computed
        self.z = np.atleast_1d(z)
        self.k = np.atleast_1d(k)
        self.nz = len(self.z)
        self.nk = len(self.k)

        # Growth factor
        self.growth_factor = self.cosmology.growth_factor_scale_independent(
            self.z)

        # Power spectrum dictionary initialization
        self.Pk = {}
        self.Pk['matter'] = {}

        # Load linear power spectrum
        self.load_Pk()

        # Initialize mass
        self.nm = 512
        self.mass = np.logspace(2., 18., self.nm)

        # Peak height
        self.peak_height = self.nu()

        # virial_radii
        self.rv = self.R_v(self.mass)
示例#3
0
#========================

# Define cosmology instance
# We report as example all cosmological parameters
# but the syntax cc.cosmo() is sufficient to have all
# parameters set to default value.
C = cc.cosmo(
    Omega_m=
    0.3089,  # total matter (CDM + baryons + neutrinos) density parameter today
    Omega_b=0.0486,  # baryon density parameter today
    Omega_K=
    0.,  # Curvature density parameter (Omega_lambda will be set as 1-Omega_K-Omega_m-Omega_b-Omega_gamma
    ns=0.9667,  # Scalar spectral index of primordial perturbation
    As=2.14e-9,  # Scalar amplitude of primordial perturbation
    sigma_8=None,  # Power spectrum normalization (set to None as As is defined)
    h=0.6774,  # Hubble parameter in units of 100 km/s/Mpc
    w0=-1.,  # Dark energy parameter of state today
    wa=0.,  # Evolution of dark energy parameter of state
    tau=0.06,  # Optical depth to reionization
    T_cmb=2.7255,  # CMB temperature today (fixes Omega_gamma)
    M_nu=[0.05, 0.01
          ],  # Neutrino masses in eV: in this case we have 2 massive neutrinos
    N_nu=3,  # Total number of neutrino species
    N_eff=3.046
)  # Effective number of neutrinos: since 2 are massive, only N_eff - massive_nu will be massless

print("Omega matter:         %.4f" % (C.Omega_m))
print("Omega CDM:            %.4f" % (C.Omega_cdm))
print("Omega baryons:        %.4f" % (C.Omega_b))
print("Omega curvature:      %.4f" % (C.Omega_K))
print("Omega Lambda:         %.3e" % (C.Omega_lambda))
示例#4
0
# Colors for different multipoles
colors = ['b', 'r', 'g', 'y', 'k', 'c']

# Choose RSD model among:
#  - 'linear'     (use linear power spectrum)
#  - 'nonlinear'  (use nonlinear power spectrum with Halofit)
#  - 'HOD'        (use HOD for the real space galaxy power spectrum)
#  - 'halo model' (use halo model directly in redshift-space)
RSD_model = 'nonlinear'
#---------------------

#---------------------
# Cosmology instance
#---------------------
C = cc.cosmo()
#---------------------

#---------------------
# RSD instance
#---------------------
Z = rsd.RSD(
    z=zz,  # Redshift
    k=np.geomspace(0.0005, 10., 201),  # Scales in h/Mpc
    mu=np.linspace(0., 1., 31),  # Cosine of angles with LOS
    k_par=np.linspace(0.01, 1., 51),  # Scales parallel in h/Mpc
    k_perp=np.linspace(0.01, 1., 31),  # Scales perpendicular in h/Mpc
    BAO_smearing=True,  # Smooth BAO feature in non-linearities
    cosmology=C)  # Cosmology
print(">> RSD instance loaded")
#---------------------
# 'mead'        (good for neutrinos)
# 'mead2020'    (good for neutrinos)
# 'takahashi'   (good for neutrinos)
# 'bird'        (good for neutrinos)
# 'halomodel'   (good for neutrinos)
# 'classichm'   (not good for neutrinos)
set_halofit = 'mead2020'
#########################

#=================
# This code computes the non-linear matter power spectrum with different methods
# 1) the Halofit operator defined in CAMB
# 2) the Halofit operator defined in the `nonlinear.py` module
#=================
# Cosmology, redshifts and scales
C = cc.cosmo(Omega_m=0.3089, Omega_b=0.0486, As=2.14e-9, ns=0.9667,
             h=0.6774)  #,M_nu=0.3,w0=-1.1, wa=-0.3)
zz = np.linspace(0., 5., 6)
kk = np.logspace(-4., 2., 201)
zz = np.atleast_1d(zz)

#=================
# 1) Compute the non-linear power spectrum with CAMB
#=================
if set_halofit != 'classichm':
    k_camb, pk_nl_camb = C.camb_Pk(k=kk,
                                   z=zz,
                                   nonlinear=True,
                                   halofit=set_halofit)
else:
    import colibri.halo as hc
    H = hc.halo(z=zz, k=kk, code='camb', cosmology=C)
示例#6
0
import colibri.fourier as FF
import colibri.useful_functions as UF
import matplotlib.pyplot as plt

plt.rc('text', usetex=True)
plt.rc('font', family='serif', size=30)

######################
# Test of FFTlog
######################
# This routine computes the linear power spectrum, inverse Fourier transforms it
# and then goes back to Fourier space to check both the correlation function and
# the goodness of the inversion

# Define cosmology
C = cc.cosmo(M_nu=0.0)

# Compute linear power spectrum with camb
k, pk = C.camb_Pk(z=0, k=np.logspace(-4., 2.5, 1001))
# The power spectrum is a matrix of shape (1,len(k)). Take the first element, i.e. an array of len(k)
pk = pk[0]
# Extrapolate a power law at low- and high-ends
k, pk = UF.extrapolate_log(k, pk, xmin=1e-10, xmax=1e6)

# Compute correlation function through inverse FFT in 3D
r, xi = FF.iFFT_iso_3D(k, pk)

# Go back to Fourier space through FFTlog
k_fft, pk_fft = FF.FFT_iso_3D(r, xi)

# Plot
示例#7
0
import matplotlib.pyplot as plt

plt.rc('text', usetex=True)
plt.rc('font', size=25, family='serif')

#===========
# Fixed
#===========
RR = np.geomspace(0.1, 50., 101)  # Radii of voids
DNL = -0.8  # Underdensity for voids
IMAX = 200  # Max index of sum (must be >= 200)

#===========
# Cosmology
#===========
C = cc.cosmo(Omega_m=0.26, Omega_b=0.044, ns=0.96, As=2.168e-9, h=0.715)

#===========
# Redshifts and scales
#===========
zz = np.linspace(0., 5., 11)
kk = np.logspace(-4., 2, 1001)

#===========
# Linear power spectra
#===========
_, pk = C.camb_Pk(z=zz, k=kk)

#===========
# VSFs
#===========