sp_validation.cosmology¶
COSMOLOGY.
- Name:
cosmology.py
- Description:
This file contains methods for science validation of a weak-lensing shape catalogue. Depends on a cosmological model.
- Author:
Axel Guinot, Martin Kilbinger, Cail Daley
- _ccl_to_camb(cosmo)[source]¶
Convert CCL cosmology object to CAMB parameter format.
- Parameters:
cosmo (ccl.Cosmology) – CCL cosmology object
- Returns:
CAMB parameters dictionary with As properly set
- Return type:
- _cosmocov_to_ccl(cosmocov_params)[source]¶
Convert CosmoCov parameter format to CCL parameter dictionary.
- get_cosmo(Omega_b=None, Omega_m=None, h=None, sig8=None, ns=None, w0=None, wa=None, transfer_function='boltzmann_camb', matter_power_spectrum='halofit', cosmocov_params=None, camb_params=None)[source]¶
Get CCL cosmology object with user-specified parameters.
Defaults to astropy Planck18 cosmology (Table 2: TT,TE,EE+lowE+lensing+BAO). Can also use CosmoCov or CAMB parameter formats.
- Parameters:
Omega_m (float, default=None) – Matter density parameter (defaults to Planck18: 0.30966)
Omega_b (float, default=None) – Baryon density parameter (defaults to Planck18: 0.04897)
h (float, default=None) – Reduced Hubble constant (defaults to Planck18: 0.6766)
sig8 (float, default=None) – RMS matter fluctuation amplitude at 8 Mpc/h (defaults to Planck18: 0.8102)
ns (float, default=None) – Scalar spectral index (defaults to Planck18: 0.9665)
w0 (float, default=None) – Dark energy equation of state parameter (defaults to -1.0)
wa (float, default=None) – Dark energy equation of state evolution parameter (defaults to 0.0)
transfer_function (str, default='boltzmann_camb') – Transfer function to use
matter_power_spectrum (str, default='halofit') – Matter power spectrum to use
cosmocov_params (dict, optional) – Parameters in CosmoCov format (Omega_m, omb, h0, sigma_8, n_spec) If provided, entries override above parameters. Mutually exclusive with camb_params.
camb_params (dict, optional) – Parameters in CAMB format (H0, ombh2, omch2, ns, sigma8) If provided, entries override above parameters. Mutually exclusive with cosmocov_params.
- Returns:
pyccl cosmology object
- Return type:
Cosmology
- get_theo_c_ell(ell, z, nz, backend='ccl', cosmo=None, Omega_b=None, Omega_m=None, h=None, sig8=None, ns=None, w0=None, wa=None)[source]¶
Calculate theoretical angular power spectrum C_ell for weak lensing.
- Parameters:
ell (array) – Multipole moments (e.g., np.arange(2, 2000))
z (array) – Redshifts for n(z) distribution
nz (array) – n(z) redshift distribution
backend (str, default="ccl") – Backend to use: “ccl” or “camb”
cosmo (ccl.Cosmology, optional) – CCL cosmology object. If None, will create using individual parameters.
Omega_b (float, optional) – Baryon density parameter (defaults to Planck 2018)
Omega_m (float, optional) – Matter density parameter (defaults to Planck 2018)
h (float, optional) – Reduced Hubble constant (defaults to Planck 2018)
sig8 (float, optional) – RMS matter fluctuation amplitude at 8 Mpc/h (defaults to Planck 2018)
ns (float, optional) – Scalar spectral index (defaults to Planck 2018)
w0 (float, optional) – Dark energy equation of state parameter (defaults to -1.0)
wa (float, optional) – Dark energy equation of state evolution parameter (defaults to 0.0)
- Returns:
cl – Angular power spectrum
- Return type:
array
- c_ell_to_xi(cosmo, theta, ell, cl)[source]¶
Convert angular power spectrum to correlation functions using CCL.
- Parameters:
cosmo (ccl.Cosmology) – CCL cosmology object (used for correlation function calculation)
theta (array) – Angular separations in arcminutes
ell (array) – Multipole moments
cl (array) – Angular power spectrum
- Returns:
xip, xim – xi+ and xi- correlation functions
- Return type:
arrays
- get_theo_xi(theta, z, nz, Omega_m=None, h=None, Omega_b=None, sig8=None, ns=None, ell_min=10, ell_max=20000, n_ell=500, backend='ccl', cosmo=None, **cosmo_kwargs)[source]¶
Calculate theoretical xi+/xi- using individual parameters.
- Parameters:
theta (array) – Angular separations in arcminutes
z (array) – Redshift array
nz (array) – n(z) redshift distribution
Omega_m (float, default=None) – Matter density parameter (defaults to Planck 2018)
h (float, default=None) – Reduced Hubble constant (defaults to Planck 2018)
Omega_b (float, default=None) – Baryon density parameter (defaults to Planck 2018)
sig8 (float, default=None) – RMS matter fluctuation amplitude at 8 Mpc/h (defaults to Planck 2018)
ns (float, default=None) – Scalar spectral index (defaults to Planck 2018)
ell_min (int, default=0) – Minimum ell for power spectrum calculation
ell_max (int, default=20000) – Maximum ell for power spectrum calculation
n_ell (int, default=500) – Number of ell bins
backend (str, default="ccl") – Backend to use: “ccl” or “camb”
**cosmo_kwargs – Additional arguments passed to backend
- Returns:
xip, xim – Theoretical xi+ and xi- correlation functions
- Return type:
arrays
- stack_mm3(ra, dec, e1, e2, w, cluster_ra, cluster_dec, cluster_z, radius=100, n_match=100000, tree=None)[source]¶
Add docstring.
…
- gamma_T_tc(ra_pos, dec_pos, ra_cat, dec_cat, e1_cat, e2_cat, w_cat=None)[source]¶
Gamma T tc.
Compute cross-correlation between positions (forground) and lensing (background) catalogue. Also called galaxy-galaxy lensing or population lensing.
- Parameters:
ra_pos (array of float) – RA coordinates of foreground catalogue
dec_pos (array of float) – DEC coordinates of foreground catalogue
ra_cat (array of float) – RA coordinates of background catalogue
dec_cat (array of float) – DEC coordinates of background catalogue
e1_cat (array of float) – ellipticity component 1 of background catalogue
e2_cat (array of float) – ellipticity component 2 of background catalogue
w_cat (array of float, optional, default=None) – weight of background catalogue
- Returns:
meanr (array of float) – spatial bin centres
meanlogr (array of float) – log of spatial bin centres
xi (array of float) – tangential shear (E-mode)
xi_im (array of float) – cross-component shear (B- or parity mode)
rms (array of float) – R.M.S of both xi and xi_im
- xi_gal_gal_tc(ra_gal, dec_gal, e1_gal, e2_gal, w_gal, ra_star, dec_star, e1_star, e2_star, w_star=None, theta_min_amin=2, theta_max_amin=200, n_theta=20)[source]¶
Add docstring.
…