|
14 | 14 | from astropy import constants |
15 | 15 | from astropy import units |
16 | 16 |
|
| 17 | +import pyccl as ccl |
| 18 | + |
| 19 | + |
| 20 | +# Set ell_max to large value, for spline interpolation (in integral over |
| 21 | +# C_ell to get real-space correlation functions). Avoid aliasing |
| 22 | +# (oscillations) |
| 23 | +ccl.spline_params.ELL_MAX_CORR = 10_000_000 |
| 24 | + |
| 25 | +ccl.spline_params.N_ELL_CORR = 5_000 |
| 26 | + |
| 27 | + |
| 28 | +def get_cosmo_default(): |
| 29 | + """Get Cosmo Default. |
| 30 | +
|
| 31 | + Return default cosmology. |
| 32 | +
|
| 33 | + Returns |
| 34 | + ------- |
| 35 | + Cosmology |
| 36 | + pyccl cosmology object |
| 37 | +
|
| 38 | + """ |
| 39 | + cosmo = ccl.Cosmology( |
| 40 | + Omega_c=0.27, |
| 41 | + Omega_b=0.045, |
| 42 | + h=0.67, |
| 43 | + sigma8=0.83, |
| 44 | + n_s=0.96, |
| 45 | + ) |
| 46 | + |
| 47 | + return cosmo |
| 48 | + |
17 | 49 |
|
18 | 50 | def sigma_crit(z_lens, z_source, cosmo, d_lens=None, d_source=None): |
19 | 51 | """Sigma Crit. |
@@ -225,3 +257,65 @@ def sigma_crit_m1_eff( |
225 | 257 | sigma_cr_m1_eff = np.average(sigma_cr_m1_arr, weights=weights) |
226 | 258 |
|
227 | 259 | return sigma_cr_m1_eff * unit |
| 260 | + |
| 261 | + |
| 262 | +def xipm_theo( |
| 263 | + theta, |
| 264 | + cosmo, |
| 265 | + z, |
| 266 | + nz, |
| 267 | +): |
| 268 | + """Xipm Theo. |
| 269 | +
|
| 270 | + Return theoretical prediction of the shear two-point correlation function. |
| 271 | +
|
| 272 | + Parameters |
| 273 | + ---------- |
| 274 | + theta : list |
| 275 | + angular scales, list of type astropy.units.Quantity |
| 276 | + cosmo : pyccl.core.Cosmology |
| 277 | + cosmological parameters |
| 278 | + z : list |
| 279 | + redshift centers |
| 280 | + dndz : list |
| 281 | + number of galaxies for each z (arbitrary normalisation) |
| 282 | +
|
| 283 | + Returns |
| 284 | + ------- |
| 285 | + numpy.ndarray |
| 286 | + xi_+ |
| 287 | + numpy.ndarray |
| 288 | + xi_- |
| 289 | +
|
| 290 | + """ |
| 291 | + |
| 292 | + # Create objects to represent tracers of the weak lensing signal with this |
| 293 | + # number density (with has_intrinsic_alignment=False) |
| 294 | + lens_tr = ccl.WeakLensingTracer(cosmo, dndz=(z, dndz)) |
| 295 | + |
| 296 | + # Calculate the angular cross-spectrum of the two tracers as a function |
| 297 | + # of ell |
| 298 | + # MKDEBUG TODO: vary, use unions-shear-ustc-cea/unions_wl/defaults.py |
| 299 | + ell = np.logspace(0, np.log10(10000), 1000) |
| 300 | + cl = ccl.angular_cl(cosmo, lens_tr, lens_tr, ell) |
| 301 | + |
| 302 | + method = "Bessel" |
| 303 | + |
| 304 | + xip = ccl.correlation( |
| 305 | + cosmo, |
| 306 | + ell, |
| 307 | + cl, |
| 308 | + theta.to("deg"), |
| 309 | + corr_type='L+', |
| 310 | + method=method, |
| 311 | + ) |
| 312 | + xim = ccl.correlation( |
| 313 | + cosmo, |
| 314 | + ell, |
| 315 | + cl, |
| 316 | + theta.to("deg"), |
| 317 | + corr_type='L-', |
| 318 | + method=method, |
| 319 | + ) |
| 320 | + |
| 321 | + return xip, xim |
0 commit comments