Bases: SpecificTypeQuantity
A one-dimensional distance.
This can be initialized by providing one of the following:
Distance value
(array or float) and a unit
Quantity
object with dimensionality of length
Redshift and (optionally) a Cosmology
Distance modulus
Parallax
Quantity
[:ref: ‘length’]
The value of this distance.
UnitBase
[:ref: ‘length’]
The unit for this distance.
float
A redshift for this distance. It will be converted to a distance by computing the luminosity distance for this redshift given the cosmology specified by cosmology
. Must be given as a keyword argument.
Cosmology
or None
A cosmology that will be used to compute the distance from z
. If None
, the current cosmology will be used (see astropy.cosmology
for details).
float
or Quantity
The distance modulus for this distance. Note that if unit
is not provided, a guess will be made at the unit between AU, pc, kpc, and Mpc.
The parallax in angular units.
dtype
, optional
See Quantity
.
See Quantity
.
See Quantity
.
See Quantity
.
int
, optional
See Quantity
.
Whether to allow negative distances (which are possible in some cosmologies). Default: False
.
UnitsError
If the unit
is not a length unit.
ValueError
If value specified is less than 0 and allow_negative=False
.
If cosmology
is provided when z
is not given.
If either none or more than one of value
, z
, distmod
, or parallax
were given.
Examples
>>> from astropy import units as u >>> from astropy.cosmology import WMAP5 >>> Distance(10, u.Mpc) <Distance 10. Mpc> >>> Distance(40*u.pc, unit=u.kpc) <Distance 0.04 kpc> >>> Distance(z=0.23) <Distance 1184.01657566 Mpc> >>> Distance(z=0.23, cosmology=WMAP5) <Distance 1147.78831918 Mpc> >>> Distance(distmod=24.47*u.mag) <Distance 783.42964277 kpc> >>> Distance(parallax=21.34*u.mas) <Distance 46.86035614 pc>
Attributes Summary
Methods Summary
Attributes Documentation
The distance modulus as a Quantity
.
The parallax angle as an Angle
object.
Short for self.compute_z()
.
Methods Documentation
The redshift for this distance assuming its physical distance is a luminosity distance.
Cosmology
or None
The cosmology to assume for this calculation, or None
to use the current cosmology (see astropy.cosmology
for details).
keyword arguments for z_at_value()
Quantity
The redshift of this distance given the provided cosmology
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4