redshift_distance

astropy.cosmology.units.redshift_distance(cosmology=None, kind='comoving', **atzkw)[source]

Convert quantities between redshift and distance.

Care should be taken to not misinterpret a relativistic, gravitational, etc redshift as a cosmological one.

Parameters:
cosmologyCosmology, python:str, or python:None, optional

A cosmology realization or built-in cosmology’s name (e.g. ‘Planck18’). If None, will use the default cosmology (controlled by default_cosmology).

kind{‘comoving’, ‘lookback’, ‘luminosity’} or python:None, optional

The distance type for the Equivalency. Note this does NOT include the angular diameter distance as this distance measure is not monotonic.

**atzkw

keyword arguments for z_at_value()

Returns:
Equivalency

Equivalency between redshift and temperature.

Examples

>>> import astropy.units as u
>>> import astropy.cosmology.units as cu
>>> from astropy.cosmology import WMAP9
>>> z = 1100 * cu.redshift
>>> z.to(u.Mpc, cu.redshift_distance(WMAP9, kind="comoving"))  
<Quantity 14004.03157418 Mpc>