wcosmo.wcosmo.z_at_value#
- wcosmo.wcosmo.z_at_value(func, fval, zmin=0.0001, zmax=100, **kwargs)[source]#
Compute the redshift at which a function equals a given value.
This follows the approach in
astropy
’sz_at_value
function closely, but uses linear interpolation instead of a root finder.- Parameters:
- func: callable
The function to evaluate, e.g.,
Planck15.luminosity_distance
, this should takefval
as the only input.- fval: float | array-like
The value of the function at the desired redshift
- zmin: float
The minimum redshift used in the conversion from distance to redshift, default=1e-4
- zmax: float
The maximum redshift used in the conversion from distance to redshift, default=100
- Returns:
- z: float
The redshift at which the function equals the desired value