clmm.cosmology.parent_class module

@file parent_class.py CLMMCosmology abstract class

class clmm.cosmology.parent_class.CLMMCosmology(validate_input=True, **kwargs)[source]

Bases: object

Cosmology object superclass for supporting multiple back-end cosmology objects

Variables:
  • backend (str) -- Name of back-end used

  • be_cosmo (cosmology library) -- Cosmology library used in the back-end

  • validate_input (bool) -- Validade each input argument

  • additional_config (dict) -- Dictionary with additional (implicit) config that will be used by the class.

eval_da(z)[source]

Computes the angular diameter distance between 0.0 and z

\[d_a(z) = \frac{c}{H_0}\frac{1}{1+z}\int_{0}^{z}\frac{dz'}{E(z')}.\]
Parameters:

z (float, array_like) -- Redshift

Returns:

Angular diameter distance in units \(M\!pc\)

Return type:

float, numpy.ndarray

eval_da_a1a2(a1, a2=1.0)[source]

This is a function to calculate the angular diameter distance between two scale factors.

\[d_a(a1, a2) = \frac{c}{H_0}a2\int_{a2}^{a1}\frac{da'}{a'^2E(a')}\]

If only a1 is specified, this function returns the angular diameter distance from a=1 to a1. If both a1 and a2 are specified, this function returns the angular diameter distance between a1 and a2.

\[d_a(a) = \frac{c}{H_0}a\int_{a}^{1}\frac{da'}{a'^2E(a')}\]
Parameters:
  • a1 (float, array_like) -- Scale factor

  • a2 (float, array_like, optional) -- Scale factor

Returns:

Angular diameter distance in units \(M\!pc\)

Return type:

float, numpy.ndarray

eval_da_z1z2(z1, z2)[source]

Computes the angular diameter distance between z1 and z2

\[d_a(z1, z2) = \frac{c}{H_0}\frac{1}{1+z2}\int_{z1}^{z2}\frac{dz'}{E(z')}.\]
Parameters:
  • z1 (float, array_like) -- Redshift

  • z2 (float, array_like) -- Redshift

Returns:

Angular diameter distance in units \(M\!pc\)

Return type:

float, numpy.ndarray

Notes

np.nan is returned for z1>z2.

eval_linear_matter_powerspectrum(k_vals, redshift)[source]

Computes the linear matter power spectrum

Parameters:
  • k_vals (float, array_like) -- Wavenumber k [math:Mpc^{-1}] values to compute the power spectrum.

  • redshift (float) -- Redshift to get the power spectrum.

Returns:

Linear matter spectrum in units of math:Mpc^{3}

Return type:

float, numpy.ndarray

eval_sigma_crit(z_len, z_src)[source]

Computes the critical surface density

Parameters:
  • z_len (float) -- Lens redshift

  • z_src (float, array_like) -- Background source galaxy redshift(s)

Returns:

Cosmology-dependent critical surface density in units of \(M_\odot\ Mpc^{-2}\)

Return type:

float, numpy.ndarray

Notes

np.inf is returned for z_src<z_len.

get_E2(z)[source]

Gets the value of the hubble parameter (normalized at 0)

\[E^2(z) = \frac{H(z)^{2}}{H_{0}^{2}}.\]
Parameters:

z (float) -- Redshift.

Returns:

Hubble parameter -- \(H(z)^{2}/H_{0}^{2}\).

Return type:

float

Notes

Need to decide if non-relativist neutrinos will contribute here.

get_E2Omega_m(z)[source]

Gets the value of the dimensionless matter density times the Hubble parameter squared (normalized at 0)

\[\Omega_m(z) = \frac{\rho_m(z)}{\rho_\text{crit}(z)}\frac{H(z)^{2}}{H_{0}^{2}}.\]
Parameters:

z (float, array_like) -- Redshift

Returns:

Omega_m -- Dimensionless matter density, \(\Omega_m(z)\times H(z)^{2}/H_{0}^{2}\)

Return type:

float, numpy.ndarray

Notes

Need to decide if non-relativist neutrinos will contribute here.

get_Omega_m(z)[source]

Gets the value of the dimensionless matter density

\[\Omega_m(z) = \frac{\rho_m(z)}{\rho_\text{crit}(z)}.\]
Parameters:

z (float, array_like) -- Redshift

Returns:

Omega_m -- Dimensionless matter density, \(\Omega_m(z)\)

Return type:

float, numpy.ndarray

Notes

Need to decide if non-relativist neutrinos will contribute here.

get_a_from_z(z)[source]

Convert redshift to scale factor

Parameters:

z (float, array_like) -- Redshift

Returns:

a -- Scale factor

Return type:

float, numpy.ndarray

get_desc()[source]

Returns the Cosmology description.

get_rho_c(z)[source]

Gets physical critical density at a given redshift.

Parameters:

z (float) -- Redshift.

Returns:

Critical density \(M_\odot\ Mpc^{-3}\).

Return type:

float

get_rho_m(z)[source]

Gets physical matter density at a given redshift.

Parameters:

z (float, array_like) -- Redshift

Returns:

Matter density \(M_\odot\ Mpc^{-3}\)

Return type:

float, numpy.ndarray

get_z_from_a(a)[source]

Convert scale factor to redshift

Parameters:

a (float, array_like) -- Scale factor

Returns:

z -- Redshift

Return type:

float, numpy.ndarray

init_from_params(H0=67.66, Omega_b0=0.049, Omega_dm0=0.262, Omega_k0=0.0)[source]

Set the cosmology from parameters

Parameters:
  • H0 (float) -- Hubble parameter.

  • Omega_b0 (float) -- Mass density of baryons today.

  • Omega_dm0 (float) -- Mass density of dark matter only (no baryons) today.

  • Omega_k0 (float) -- Mass density of curvature today.

mpc2rad(dist1, redshift)[source]

Convert between radians and Mpc using the small angle approximation and \(d = D_A \theta\).

Parameters:
  • dist1 (float, array_like) -- Input distances in Mpc

  • redshift (float) -- Redshift used to convert between angular and physical units

Returns:

dist2 -- Distances in radians

Return type:

float, numpy.ndarray

rad2mpc(dist1, redshift)[source]

Convert between radians and Mpc using the small angle approximation and \(d = D_A \theta\).

Parameters:
  • dist1 (float, array_like) -- Input distances in radians

  • redshift (float) -- Redshift used to convert between angular and physical units

Returns:

dist2 -- Distances in Mpc

Return type:

float, numpy.ndarray

set_be_cosmo(be_cosmo=None, H0=67.66, Omega_b0=0.049, Omega_dm0=0.262, Omega_k0=0.0)[source]

Set the cosmology

Parameters:
  • be_cosmo (clmm.cosmology.Cosmology object, None) -- Input cosmology, used if not None.

  • **kwargs -- Individual cosmological parameters, see init_from_params function.