Bases: object
A onedimensional distance.
This can be initialized in one of three ways: a distance and a unit, a Quantity object, or a redshift and (optionally) a cosmology. value and unit may be provided as positional arguments, but z and cosmology are only valid as keyword arguments (see examples).
Parameters :  value : scalar or Quantity
unit : UnitBase
z : float
cosmology : Cosmology or None


Raises :  UnitsError :

Examples
>>> from astropy import units as u
>>> from astropy.cosmology import WMAP3
>>> d1 = Distance(10, u.Mpc)
>>> d2 = Distance(40, unit=u.au)
>>> d3 = Distance(value=5, unit=u.kpc)
>>> d4 = Distance(z=0.23)
>>> d5 = Distance(z=0.23, cosmology=WMAP3)
Attributes Summary
Mpc  The value of this distance in megaparsecs 
au  The value of this distance in astronomical units 
km  The value of this distance in kilometers 
kpc  The value of this distance in kiloparsecs 
lightyear  The value of this distance in light years 
m  The value of this distance in meters 
pc  The value of this distance in parsecs 
z  The redshift for this distance assuming its physical distance is a luminosity distance. 
Methods Summary
compute_z([cosmology])  The redshift for this distance assuming its physical distance is a luminosity distance. 
Attributes Documentation
The redshift for this distance assuming its physical distance is a luminosity distance.
Note
This uses the “current” cosmology to determine the appropriate distance to redshift conversions. See astropy.cosmology for details on how to change this.
Methods Documentation
The redshift for this distance assuming its physical distance is a luminosity distance.
Parameters :  cosmology : cosmology or None

