halox.cosmology: Cosmology calculations

halox.cosmology: Cosmology calculations#

For cosmology calculations, halox relies on jax-cosmo, and adds a few convenience functions.

hubble_parameter(z, cosmo)

Computes the Hubble parameter \(H(z)\) at a given redshift for a given cosmology.

critical_density(z, cosmo)

Computes the Universe critical density \(\rho_c(z)\) at a given redshift for a given cosmology.

differential_comoving_volume(z, cosmo)

Computes the differential comoving volume element per solid angle, \({\rm d}V_c / {\rm d}\Omega {\rm d}z\), at a given redshift for a given cosmology.

sensitivity(func, cosmo)

Computes the sensitivity of a scalar function to each cosmological parameter using autodifferentiation.

halox.cosmology.hubble_parameter(z, cosmo)[source]#

Computes the Hubble parameter \(H(z)\) at a given redshift for a given cosmology.

Parameters:
  • z (Array) – Redshift

  • cosmo (jc.Cosmology) – Underlying cosmology

Returns:

Hubble parameter at z [km s-1 Mpc-1]

Return type:

Array

halox.cosmology.critical_density(z, cosmo)[source]#

Computes the Universe critical density \(\rho_c(z)\) at a given redshift for a given cosmology.

Parameters:
  • z (Array) – Redshift

  • cosmo (jc.Cosmology) – Underlying cosmology

Returns:

Critical density at z [h2 Msun Mpc-3]

Return type:

Array

halox.cosmology.differential_comoving_volume(z, cosmo)[source]#

Computes the differential comoving volume element per solid angle, \({\rm d}V_c / {\rm d}\Omega {\rm d}z\), at a given redshift for a given cosmology.

Parameters:
  • z (Array) – Redshift

  • cosmo (jc.Cosmology) – Underlying cosmology

Returns:

Differential comoving volume element at z [h-3 Mpc3 sr-1]

Return type:

Array

halox.cosmology.sensitivity(func, cosmo)[source]#

Computes the sensitivity of a scalar function to each cosmological parameter using autodifferentiation. Gradients are evaluated at the given cosmology and at two perturbed cosmologies (all parameters scaled by 0.9 and 1.1) to avoid missing sensitivity at local extrema.

Parameters:
  • func (Callable[[jc.Cosmology], Array]) – A function that takes a jax_cosmo.Cosmology and returns a scalar.

  • cosmo (jc.Cosmology) – Underlying cosmology

Returns:

Names of cosmological parameters to which func is sensitive.

Return type:

list[str]