clevar.cosmology.parent_class module

class clevar.cosmology.parent_class.Cosmology(**kwargs)[source]

Bases: object

Cosmology object superclass for supporting multiple back-end cosmology objects

Variables
  • ~Cosmology.backend (str) – Name of back-end used

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

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) – Redshift.

Returns

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

Return type

float

Notes

Describe the vectorization.

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) – Redshift.

  • z2 (float) – Redshift.

Returns

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

Return type

float

Notes

Describe the vectorization.

eval_mass2radius(mass, z, delta=200, mass_type='background')[source]

Computes the radius from M_Delta

\[R_{\Delta} = \left(\frac{3M_{\Delta}}{4\pi\Delta\rho}\right)^{1/3}\]

where \(\rho\) can be background or matter.

Parameters
  • MASS (float, array) – Mass of the volume in M_sun

  • z (float, array) – Redshift

  • delta (int, float) – Delta

Returns

Radius in Mpc

Return type

float, array

get_E2(z)[source]

Gets hubble parameter squared (normalized at 0)

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

z (float) – Redshift.

Returns

E – Dimensionless normalized hubble parameter

Return type

float

get_Omega_m(z)[source]

Gets the value of the dimensionless matter density

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

z (float) – Redshift.

Returns

Omega_m – dimensionless matter density, \(\Omega_m(z)\).

Return type

float

Notes

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

get_desc()[source]

Returns the Cosmology description.

mpc2rad(dist1, redshift)[source]

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

Parameters
  • dist1 (array_like) – Input distances in Mpc

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

  • cosmo (astropy.cosmology) – Astropy cosmology object to compute angular diameter distance to convert between physical and angular units

  • do_inverse (bool) – If true, converts Mpc to radians

Returns

dist2 – Distances in radians

Return type

array_like

rad2mpc(dist1, redshift)[source]

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

Parameters
  • dist1 (array_like) – Input distances in radians

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

  • cosmo (astropy.cosmology) – Astropy cosmology object to compute angular diameter distance to convert between physical and angular units

  • do_inverse (bool) – If true, converts Mpc to radians

Returns

dist2 – Distances in Mpc

Return type

array_like

set_be_cosmo(be_cosmo=None, H0=70.0, Omega_b0=0.05, Omega_dm0=0.25, Omega_k0=0.0)[source]

Set the cosmology

Parameters
  • be_cosmo (clevar.Cosmology, None) – Input cosmology, used if not None

  • **kwargs – Individual cosmological parameters