%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
#astropy
from astropy.cosmology import WMAP9
import astropy.units as u
#NICAEA bindings
from lenstools.simulations import Nicaea,NicaeaSettings
Generate default settings for NICAEA
settings = NicaeaSettings.default()
settings
{'normmode': 'norm_s8', 'q_mag_size': 1.0, 'sde_param': 'linder', 'sgrowth': 'growth_de', 'snonlinear': 'smith03', 'sreduced': 'none', 'stomo': 'tomo_all', 'stransfer': 'eisenhu'}
You can also see the available tunable options, and the allowed values for each option
settings.knobs
['sde_param', 'sgrowth', 'sreduced', 'normmode', 'stomo', 'stransfer', 'snonlinear', 'q_mag_size']
settings.available("snonlinear")
['linear', 'pd96', 'smith03', 'smith03_de', 'coyote10', 'coyote13', 'halodm', 'smith03_revised']
Instantiate a Nicaea object directly from one of astropy built-in cosmology instances
cosmo = Nicaea.fromCosmology(WMAP9)
cosmo
Nicaea(H0=69.3 km / (Mpc s), Om0=0.286, Ode0=0.713, sigma8=0.8, ns=0.96, Ob0=0.046, w0=-1, wa=0, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV)
Select the multipoles
ell = np.arange(300.0,1.0e5,500.0)
Compute the power spectrum (assuming single redshift source distribution at $z=2$)
power = cosmo.convergencePowerSpectrum(ell,z=2.0,settings=settings)
fig,ax = plt.subplots(figsize=(8,8))
ax.plot(ell,ell*(ell+1)*power/(2.0*np.pi))
ax.set_xscale("log")
ax.set_yscale("log")
ax.set_xlabel(r"$l$",fontsize=18)
ax.set_ylabel(r"$l(l+1)P_l/2\pi$",fontsize=18)
<matplotlib.text.Text at 0x10a0f4b90>
Tomography settings are supported too: let's create a simple redshift distribution $n(z)\propto z^ae^{-(z/z_0)^b}$
def n(z,a,b,z0):
return (z**a)*np.exp(-(z/z0)**b)
Do tomography with 5 redshift bins in $z\in[0.1,3.0]$
z = np.linspace(0.1,3.0,5)
z
array([ 0.1 , 0.825, 1.55 , 2.275, 3. ])
Compute power spectrum tomography for $(a,b,z_0)=(1,2,0.7)$
power_tomo = cosmo.convergencePowerSpectrum(ell,z=z,distribution=n,distribution_parameters="all",a=1.0,b=2.0,z0=0.7)
power_tomo.shape
(200, 10)
We can easily switch tomography off by considering a single redshift bin with distribution $n(z)$ inside it
power_tomo = cosmo.convergencePowerSpectrum(ell,z=z,distribution=n,distribution_parameters="one",a=1.0,b=2.0,z0=0.7)
power_tomo.shape
(200,)
Select angles $\theta$
theta = np.arange(1.0,100.0,1.0)*u.arcmin
xi_plus = cosmo.shearTwoPoint(theta,z=2.0,settings=settings,kind="+")
xi_minus = cosmo.shearTwoPoint(theta,z=2.0,settings=settings,kind="-")
fig,ax = plt.subplots(figsize=(8,8))
ax.plot(theta,xi_plus,label=r"$\xi_+$")
ax.plot(theta,xi_minus,label=r"$\xi_-$")
ax.set_xscale("log")
ax.set_xlabel(r"$\theta(\mathrm{arcmin})$",fontsize=18)
ax.set_ylabel(r"$\xi(\theta)$",fontsize=18)
ax.legend()
<matplotlib.legend.Legend at 0x10a5bc950>