Flat Lambda CDM
flat_lambda_cdm
¶
Functions to compute cosmological quantities under flat lambda CDM model.
Functions:¶
compute_normalized_hubble_parameter
¶
compute_normalized_hubble_parameter(redshift: Array, omega_m: Array) -> Array
Compute the normalized Hubble parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
redshift
|
Array
|
Redshift. |
required |
omega_m
|
Array
|
Matter density. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Normalized Hubble parameter. |
compute_hubble_parameter
¶
compute_hubble_parameter(redshift: Array, hubble_constant: Array, omega_m: Array) -> Array
Compute the Hubble parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
redshift
|
Array
|
Redshift. |
required |
hubble_constant
|
Array
|
Hubble constant in km / s / Mpc. |
required |
omega_m
|
Array
|
Matter density. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Hubble parameter in km / s/ Mpc. |
compute_comoving_distance
¶
compute_comoving_distance(redshift: Array, hubble_constant: Array, omega_m: Array, n_grid: int = 1000) -> Array
Compute the comoving distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
redshift
|
Array
|
Redshift to evaluate the comoving distance. |
required |
hubble_constant
|
Array
|
Hubble constant in km / s / Mpc. |
required |
omega_m
|
Array
|
Matter density. |
required |
n_grid
|
int
|
Number of grid points to perform the numerical integration. |
1000
|
Returns:
| Type | Description |
|---|---|
Array
|
Comoving distance in Mpc. |
compute_differential_comoving_volume
¶
compute_differential_comoving_volume(redshift: Array, hubble_constant: Array, omega_m: Array, n_grid: int = 1000) -> Array
Compute the differential comoving volume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
redshift
|
Array
|
Redshift. |
required |
hubble_constant
|
Array
|
Hubble constant in km / s / Mpc. |
required |
omega_m
|
Array
|
Matter density. |
required |
n_grid
|
int
|
Number of grid points to perform the numerical integration. |
1000
|
Returns:
| Type | Description |
|---|---|
Array
|
Differential comoving volume in Mpc^{3}. |
compute_luminosity_distance
¶
compute_luminosity_distance(redshift: Array, hubble_constant: Array, omega_m: Array, n_grid: int = 1000) -> Array
Compute the luminosity distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
redshift
|
Array
|
Redshift to evaluate the luminosity distance. |
required |
hubble_constant
|
Array
|
Hubble constant in km / s / Mpc. |
required |
omega_m
|
Array
|
Matter density. |
required |
n_grid
|
int
|
Number of grid points to perform the numerical integration. |
1000
|
Returns:
| Type | Description |
|---|---|
Array
|
Luminosity distance in Mpc. |
build_distance_lookup
¶
build_distance_lookup(*, hubble_constant: float = PLANCK18_H0_KM_S_MPC, omega_m: float = PLANCK18_OMEGA_M, max_redshift: float = DEFAULT_MAX_REDSHIFT, n_grid: int = DEFAULT_LOOKUP_GRID_SIZE) -> tuple[Array, Array, Array]
Build flat-ΛCDM lookup tables for redshift, comoving distance, and luminosity distance.
The redshift grid is 0 followed by n_grid - 1 points spaced uniformly in
log z from MIN_LOOKUP_NONZERO_REDSHIFT to max_redshift. A grid uniform
in z would leave a first interval so wide that linear interpolation misstates
d_L there by about (1 - q0) / 2 * dz; the logarithmic grid keeps the
relative interpolation error small down to MIN_LOOKUP_NONZERO_REDSHIFT.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hubble_constant
|
float
|
Hubble constant in km / s / Mpc. |
PLANCK18_H0_KM_S_MPC
|
omega_m
|
float
|
Matter density. |
PLANCK18_OMEGA_M
|
max_redshift
|
float
|
Largest redshift tabulated by the lookup. |
DEFAULT_MAX_REDSHIFT
|
n_grid
|
int
|
Number of tabulation points. |
DEFAULT_LOOKUP_GRID_SIZE
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array]
|
Tuple |
interpolate_within_lookup
¶
interpolate_within_lookup(values: Array, grid: Array, table: Array, name: str) -> Array
Linearly interpolate table over grid at values, refusing to extrapolate.
Interpolating outside [0, grid[-1]] would silently return the table edge.
Concrete (eager) input outside that range raises ValueError. Traced input
(under jax.jit, jax.vmap, jax.lax.scan, ...) cannot raise on a
data-dependent condition, so there each out-of-range element is returned as
NaN instead; it does not raise. In-range elements are unaffected either way.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
Array
|
Values to be looked up. |
required |
grid
|
Array
|
Increasing tabulation points, starting at 0. |
required |
table
|
Array
|
Tabulated values at |
required |
name
|
str
|
Name of the looked-up quantity, used in the error message. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Interpolated values, NaN where a traced value is out of range. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If concrete |
compute_redshift_from_luminosity_distance
¶
compute_redshift_from_luminosity_distance(luminosity_distance: Array, *, hubble_constant: float = PLANCK18_H0_KM_S_MPC, omega_m: float = PLANCK18_OMEGA_M, max_redshift: float = DEFAULT_MAX_REDSHIFT, n_grid: int = DEFAULT_LOOKUP_GRID_SIZE) -> Array
Invert a luminosity distance to redshift via a flat-ΛCDM lookup table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
luminosity_distance
|
Array
|
Luminosity distance in Mpc. |
required |
hubble_constant
|
float
|
Hubble constant in km / s / Mpc. |
PLANCK18_H0_KM_S_MPC
|
omega_m
|
float
|
Matter density. |
PLANCK18_OMEGA_M
|
max_redshift
|
float
|
Largest redshift tabulated by the lookup. |
DEFAULT_MAX_REDSHIFT
|
n_grid
|
int
|
Number of tabulation points. |
DEFAULT_LOOKUP_GRID_SIZE
|
Returns:
| Type | Description |
|---|---|
Array
|
Redshift inferred from |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any concrete distance lies outside |