Bases: object
A one-dimensional distance.
This can be initialized in one of two ways, using either a distance and a unit, 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
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 |
pc | The value of this distance in parsecs |
m | The value of this distance in meters |
km | The value of this distance in kilometers |
kpc | The value of this distance in kiloparsecs |
au | The value of this distance in astronomical units |
lightyear | The value of this distance in light years |
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
|
---|