lenspack.theory.cosmology module

class lenspack.theory.cosmology.nicaea(path, Om0=0.25, Ode0=0.75, h=0.7, Ob0=0.044, sigma8=0.8, ns=0.95, w0=- 1.0, w1=0.0, Onu0=0.0, Neff=0.0, zs=1.0, linear=False)[source]

Bases: object

Python wrapper for NICAEA.

Compute theoretical weak-lensing quantities in a given cosmology.

See NICAEA documentation for further details at https://nicaea.readthedocs.io/en/latest/index.html

Parameters
  • path (str) – Full path to base NICAEA directory.

  • Om0 (float, optional) – Cosmological parameters.

  • ... (float, optional) – Cosmological parameters.

  • Neff (float, optional) – Cosmological parameters.

  • zs (float, optional) – Redshift of source galaxies. Only a single redshift is currently supported. Default is 1.0.

  • linear (bool, optional) – Whether to compute using only the linear matter power spectrum. Default is False, in which case the nonlinear halofit prescription of Takahashi et al. (2012) is used.

Notes

This wrapper works by copying the necessary parameter files from NICAEA’s default directory into a temporary directory. Computations are then carried out in this temporary directory, which can later be easily removed.

References

Examples

>>> # Plot two-point correlation functions
>>> nic = nicaea('.../nicaea_2.7', Om0=0.3, Ode0=0.7)
>>> nic.compute()
>>> theta, xi_p = nic.xi_p.T
>>> xi_m = nic.xi_m[:, 1]
>>> nic.destroy()
>>> fig, ax = plt.subplots(1, 1)
>>> ax.loglog(theta, xi_p, label='xi_p')
>>> ax.loglog(theta, xi_m, label='xi_m')
>>> ax.set_xlabel('theta [arcmin]')
>>> ax.set_ylabel('Two-point correlation function')
>>> ax.legend(loc=0)
>>> plt.show()
update_parfiles()[source]

Modify default parameter files to reflect user inputs.

compute(tmin=0.5, tmax=500, nt=20, lmin=10, lmax=100000.0, nl=128)[source]

Run NICAEA’s weak-lensing calculator.

Parameters
  • tmin (float, optional) – Lower and upper bounds on angular scale theta. Defaults are (0.5, 500).

  • tmax (float, optional) – Lower and upper bounds on angular scale theta. Defaults are (0.5, 500).

  • nt (int, optional) – Number of theta bins. Default is 10.

  • lmin (float, optional) – Lower and upper bounds on multipole ell. Defaults are (10, 1e5).

  • lmax (float, optional) – Lower and upper bounds on multipole ell. Defaults are (10, 1e5).

  • nl (int, optional) – Number of ell bins. Default is 128.

Notes

Four new attributes are generated as follows.

xi_p

Two-point correlation function xi+.

xi_m

Two-point correlation function xi-.

P_kappa

Convergence power spectrum (continuous ell).

P_kappa_d

Convergence power spectrum (discrete ell).

More outputs could be harvested in the future, such as gammasqr etc.

destroy(verbose=True)[source]

Remove any temporary directory and its contents.