Reference/API#
astropy.units.quantity Module#
This module defines the Quantity
object, which represents a number with some
associated units. Quantity
objects support operations like ordinary numbers,
but will deal with unit conversions internally.
Functions#
Classes#
|
A |
|
Superclass for Quantities of specific physical type. |
|
|
|
Container for meta information like name, description, format. |
Class Inheritance Diagram#
astropy.units Package#
This subpackage contains classes and functions for defining and converting between different physical units.
This code is adapted from the pynbody units module written by Andrew Pontzen, who has granted the Astropy project permission to use the code under a BSD license.
Functions#
|
Add aliases for units. |
|
Adds to the equivalencies enabled in the unit registry. |
|
Adds to the set of units enabled in the unit registry. |
|
Whether two arrays are element-wise equal within a tolerance. |
|
Convert between the |
|
Defines the conversion between Jy/sr and "brightness temperature", \(T_B\), in Kelvins. |
|
Add a mapping between a unit and the corresponding physical type(s). |
|
Factory function for defining new units. |
Allow angles to be equivalent to dimensionless (with 1 rad = 1 m/m = 1). |
|
|
Return the equivalency pairs for the optical convention for velocity. |
|
Return the equivalency pairs for the radio convention for velocity. |
Returns the equivalence between Doppler redshift (unitless) and radial velocity. |
|
|
Return the equivalency pairs for the relativistic convention for velocity. |
|
Return the physical type that corresponds to a unit (or another physical type representation). |
|
Return a boolean array where two arrays are element-wise equal within a tolerance. |
Allow logarithmic units to be converted to dimensionless fractions. |
|
Returns a list of equivalence pairs that handle the conversion between mass and energy. |
|
Returns the equivalence between amu and molar mass. |
|
|
Returns a list of equivalence pairs that handle the conversion between parallax angle and distance. |
|
Convert between pixel distances (in units of |
|
Convert between lengths (to be interpreted as lengths in the focal plane) and angular units with a specified |
|
A decorator for validating the units of arguments to functions. |
|
Set aliases for units. |
|
Sets the equivalencies enabled in the unit registry. |
|
Sets the units enabled in the unit registry. |
|
Returns a list of equivalence pairs that handle spectral wavelength, wave number, frequency, and energy equivalencies. |
|
Returns a list of equivalence pairs that handle spectral density with regard to wavelength and frequency. |
Convert between Kelvin, Celsius, Rankine and Fahrenheit here because Unit and CompositeUnit cannot do addition or subtraction properly. |
|
Convert between Kelvin and keV(eV) to an equivalent amount. |
|
|
Defines the conversion between Jy/sr and "thermodynamic temperature", \(T_{CMB}\), in Kelvins. |
|
An equivalency for converting linear flux units ("maggys") defined relative to a standard source into a standardized system. |
Classes#
|
Create a composite unit using expressions of previously defined units. |
|
|
|
Logarithmic physical units expressed in dB. |
|
|
|
Logarithmic physical units expressed in magnitudes. |
|
A container for a units equivalency. |
|
A representation of a (scaled) function of a number with a unit. |
|
Abstract base class for function units. |
|
Irreducible units are the units that all other units are defined in terms of. |
|
A representation of a (scaled) logarithm of a number with a unit. |
|
Logarithmic unit containing a physical one. |
|
Logarithmic physical units expressed in magnitudes. |
|
|
|
The base class of units that have a name. |
|
Represents the physical type(s) that are dimensionally compatible with a set of units. |
|
A unit that is simply a SI-prefixed version of another unit. |
|
A |
|
Container for meta information like name, description, format. |
|
|
|
Superclass for Quantities of specific physical type. |
|
Container for units for a structured Quantity. |
|
Container for units for a structured Quantity. |
|
The main unit class. |
|
Abstract base class for units. |
Used specifically for errors related to converting between units or interpreting units in terms of other units. |
|
Used to catch the errors involving scaled units, which are not recognized by FITS format. |
|
Used specifically for errors in setting to units not allowed by a class. |
|
The base class for unit-specific exceptions. |
|
The base class for unit-specific warnings. |
|
|
A unit that did not parse correctly. |
Class Inheritance Diagram#
astropy.units.format Package#
A collection of different unit formats.
Functions#
|
Get a formatter by name. |
Classes#
|
The abstract base class of all unit formats. |
|
A "generic" format. |
|
Support the Centre de Données astronomiques de Strasbourg Standards for Astronomical Catalogues 2.0 format, and the complete set of supported units. |
|
Output-only format for to display pretty formatting at the console. |
|
The FITS standard unit format. |
|
Output LaTeX to display the unit based on IAU style guidelines. |
|
Output LaTeX to display the unit based on IAU style guidelines with negative powers. |
|
Support the units in Office of Guest Investigator Programs (OGIP) FITS files. |
|
Output-only format to display pretty formatting at the console using Unicode characters. |
|
|
|
The IVOA standard for units used by the VO. |
Class Inheritance Diagram#
astropy.units.si Module#
This package defines the SI units. They are also available in the
astropy.units
namespace.
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
annum (a) |
\(\mathrm{365.25\,d}\) |
|
Yes |
|
ampere: base unit of electric current in SI |
|
Yes |
|
|
ångström: 10 ** -10 m |
\(\mathrm{0.1\,nm}\) |
|
Yes |
|
arc minute: angular measurement |
\(\mathrm{0.016666667\,{}^{\circ}}\) |
|
Yes |
|
arc second: angular measurement |
\(\mathrm{0.00027777778\,{}^{\circ}}\) |
|
Yes |
|
becquerel: unit of radioactivity |
\(\mathrm{\frac{1}{s}}\) |
|
No |
|
coulomb: electric charge |
\(\mathrm{A\,s}\) |
|
Yes |
|
candela: base unit of luminous intensity in SI |
|
Yes |
|
|
curie: unit of radioactivity |
\(\mathrm{3.7 \times 10^{10}\,Bq}\) |
|
No |
|
cm: 0.01 m in SI, base unit of length in cgs |
\(\mathrm{0.01\,m}\) |
|
No |
|
day (d) |
\(\mathrm{24\,h}\) |
|
Yes |
|
degree: angular measurement 1/360 of full rotation |
\(\mathrm{0.017453293\,rad}\) |
|
Yes |
|
Degrees Celsius |
|
No |
|
|
Electron Volt |
\(\mathrm{1.6021766 \times 10^{-19}\,J}\) |
|
Yes |
|
Farad: electrical capacitance |
\(\mathrm{\frac{C}{V}}\) |
|
Yes |
|
fortnight |
\(\mathrm{2\,wk}\) |
No |
|
|
gram (g) |
\(\mathrm{0.001\,kg}\) |
|
Yes |
|
hour (h) |
\(\mathrm{3600\,s}\) |
|
Yes |
|
Henry: inductance |
\(\mathrm{\frac{Wb}{A}}\) |
|
Yes |
|
hour angle: angular measurement with 24 in a full circle |
\(\mathrm{15\,{}^{\circ}}\) |
No |
|
|
Frequency |
\(\mathrm{\frac{1}{s}}\) |
|
Yes |
|
Joule: energy |
\(\mathrm{N\,m}\) |
|
Yes |
|
Kelvin: temperature with a null point at absolute zero. |
|
Yes |
|
|
kilogram: base unit of mass in SI. |
|
No |
|
|
liter: metric unit of volume |
\(\mathrm{1000\,cm^{3}}\) |
|
Yes |
|
lumen: luminous flux |
\(\mathrm{cd\,sr}\) |
|
Yes |
|
lux: luminous emittance |
\(\mathrm{\frac{lm}{m^{2}}}\) |
|
Yes |
|
meter: base unit of length in SI |
|
Yes |
|
|
milli arc second: angular measurement |
\(\mathrm{0.001\,{}^{\prime\prime}}\) |
No |
|
|
micron: alias for micrometer (um) |
\(\mathrm{\mu m}\) |
No |
|
|
minute (min) |
\(\mathrm{60\,s}\) |
|
Yes |
|
mole: amount of a chemical substance in SI. |
|
Yes |
|
|
Newton: force |
\(\mathrm{\frac{kg\,m}{s^{2}}}\) |
|
Yes |
|
Ohm: electrical resistance |
\(\mathrm{\frac{V}{A}}\) |
|
Yes |
|
Pascal: pressure |
\(\mathrm{\frac{J}{m^{3}}}\) |
|
Yes |
|
percent: one hundredth of unity, factor 0.01 |
\(\mathrm{0.01}\) |
|
No |
|
radian: angular measurement of the ratio between the length on an arc and its radius |
|
Yes |
|
|
second: base unit of time in SI. |
|
Yes |
|
|
Siemens: electrical conductance |
\(\mathrm{\frac{A}{V}}\) |
|
Yes |
|
Sidereal day (sday) is the time of one rotation of the Earth. |
\(\mathrm{86164.091\,s}\) |
No |
|
|
steradian: unit of solid angle in SI |
\(\mathrm{rad^{2}}\) |
|
Yes |
|
Metric tonne |
\(\mathrm{1000\,kg}\) |
|
No |
|
Tesla: magnetic flux density |
\(\mathrm{\frac{Wb}{m^{2}}}\) |
|
Yes |
|
micro arc second: angular measurement |
\(\mathrm{1 \times 10^{-6}\,{}^{\prime\prime}}\) |
No |
|
|
Volt: electric potential or electromotive force |
\(\mathrm{\frac{J}{C}}\) |
|
Yes |
|
Watt: power |
\(\mathrm{\frac{J}{s}}\) |
|
Yes |
|
Weber: magnetic flux |
\(\mathrm{V\,s}\) |
|
Yes |
|
week (wk) |
\(\mathrm{7\,d}\) |
|
No |
|
year (yr) |
\(\mathrm{365.25\,d}\) |
|
Yes |
astropy.units.cgs Module#
This package defines the CGS units. They are also available in the
top-level astropy.units
namespace.
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
abcoulomb: CGS (EMU) of charge |
\(\mathrm{Bi\,s}\) |
|
No |
|
Barye: CGS unit of pressure |
\(\mathrm{\frac{g}{cm\,s^{2}}}\) |
|
Yes |
|
Biot: CGS (EMU) unit of current |
\(\mathrm{\frac{cm^{1/2}\,g^{1/2}}{s}}\) |
|
No |
|
coulomb: electric charge |
\(\mathrm{A\,s}\) |
|
No |
|
candela: base unit of luminous intensity in SI |
|
No |
|
|
cm: 0.01 m in SI, base unit of length in cgs |
\(\mathrm{0.01\,m}\) |
|
No |
|
Debye: CGS unit of electric dipole moment |
\(\mathrm{3.3333333 \times 10^{-30}\,C\,m}\) |
|
Yes |
|
Degrees Celsius |
|
No |
|
|
dyne: CGS unit of force |
\(\mathrm{\frac{cm\,g}{s^{2}}}\) |
|
Yes |
|
erg: CGS unit of energy |
\(\mathrm{\frac{cm^{2}\,g}{s^{2}}}\) |
Yes |
|
|
Franklin: CGS (ESU) unit of charge |
\(\mathrm{\frac{cm^{3/2}\,g^{1/2}}{s}}\) |
|
No |
|
gram (g) |
\(\mathrm{0.001\,kg}\) |
|
No |
|
Gauss: CGS unit for magnetic field |
\(\mathrm{0.0001\,T}\) |
|
Yes |
|
Gal: CGS unit of acceleration |
\(\mathrm{\frac{cm}{s^{2}}}\) |
|
Yes |
|
Kelvin: temperature with a null point at absolute zero. |
|
No |
|
|
kayser: CGS unit of wavenumber |
\(\mathrm{\frac{1}{cm}}\) |
|
Yes |
|
mole: amount of a chemical substance in SI. |
|
No |
|
|
Maxwell: CGS unit for magnetic flux |
\(\mathrm{1 \times 10^{-8}\,Wb}\) |
|
No |
|
Oersted: CGS unit for magnetic field strength |
\(\mathrm{79.577472\,\frac{A}{m}}\) |
|
Yes |
|
poise: CGS unit of dynamic viscosity |
\(\mathrm{\frac{g}{cm\,s}}\) |
|
Yes |
|
radian: angular measurement of the ratio between the length on an arc and its radius |
|
No |
|
|
second: base unit of time in SI. |
|
No |
|
|
steradian: unit of solid angle in SI |
\(\mathrm{rad^{2}}\) |
|
No |
|
stokes: CGS unit of kinematic viscosity |
\(\mathrm{\frac{cm^{2}}{s}}\) |
|
Yes |
|
statampere: CGS (ESU) unit of current |
\(\mathrm{\frac{Fr}{s}}\) |
|
No |
astropy.units.astrophys Module#
This package defines the astrophysics-specific units. They are also
available in the astropy.units
namespace.
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
adu |
Yes |
||
|
astronomical unit: approximately the mean Earth–Sun distance. |
\(\mathrm{1.4959787 \times 10^{11}\,m}\) |
|
Yes |
|
beam |
Yes |
||
|
bin |
Yes |
||
|
chan |
Yes |
||
|
count (ct) |
|
Yes |
|
|
dn (DN) |
|
No |
|
|
Earth mass |
\(\mathrm{5.9721679 \times 10^{24}\,kg}\) |
|
No |
|
Earth radius |
\(\mathrm{6378100\,m}\) |
|
No |
|
Number of electrons |
No |
||
|
Jupiter mass |
\(\mathrm{1.8981246 \times 10^{27}\,kg}\) |
|
No |
|
Jupiter radius |
\(\mathrm{71492000\,m}\) |
|
No |
|
Jansky: spectral flux density |
\(\mathrm{1 \times 10^{-26}\,\frac{W}{Hz\,m^{2}}}\) |
|
Yes |
|
Light second |
\(\mathrm{2.9979246 \times 10^{8}\,m}\) |
|
No |
|
Light year |
\(\mathrm{9.4607305 \times 10^{15}\,m}\) |
|
Yes |
|
parsec: approximately 3.26 light-years. |
\(\mathrm{3.0856776 \times 10^{16}\,m}\) |
|
Yes |
|
photon (ph) |
|
Yes |
|
|
Rayleigh: photon flux |
\(\mathrm{7.9577472 \times 10^{8}\,\frac{ph}{s\,sr\,m^{2}}}\) |
|
Yes |
|
Rydberg: Energy of a photon whose wavenumber is the Rydberg constant |
\(\mathrm{13.605693\,eV}\) |
|
Yes |
|
Solar luminance |
\(\mathrm{3.828 \times 10^{26}\,W}\) |
|
No |
|
Solar mass |
\(\mathrm{1.9884099 \times 10^{30}\,kg}\) |
|
No |
|
Solar radius |
\(\mathrm{6.957 \times 10^{8}\,m}\) |
|
No |
|
Sun |
No |
astropy.units.misc Module#
This package defines miscellaneous units. They are also
available in the astropy.units
namespace.
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
bar: pressure |
\(\mathrm{100000\,Pa}\) |
Yes |
|
|
barn: unit of area used in HEP |
\(\mathrm{1 \times 10^{-28}\,m^{2}}\) |
|
Yes |
|
b (bit) |
|
Yes |
|
|
B (byte) |
\(\mathrm{8\,bit}\) |
|
Yes |
|
cycle: angular measurement, a full turn or rotation |
\(\mathrm{6.2831853\,rad}\) |
|
No |
|
Electron mass |
\(\mathrm{9.1093837 \times 10^{-31}\,kg}\) |
No |
|
|
Proton mass |
\(\mathrm{1.6726219 \times 10^{-27}\,kg}\) |
No |
|
|
pixel (pix) |
|
Yes |
|
|
spat: the solid angle of the sphere, 4pi sr |
\(\mathrm{12.566371\,sr}\) |
|
No |
|
Unit of pressure based on an absolute scale, now defined as exactly 1/760 of a standard atmosphere |
\(\mathrm{133.32237\,Pa}\) |
|
Yes |
|
Unified atomic mass unit |
\(\mathrm{1.6605391 \times 10^{-27}\,kg}\) |
|
Yes |
|
voxel (vox) |
|
Yes |
astropy.units.function.units Module#
This package defines units that can also be used as functions of other units.
If called, their arguments are used to initialize the corresponding function
unit (e.g., u.mag(u.ct/u.s)
). Note that the prefixed versions cannot be
called, as it would be unclear what, e.g., u.mmag(u.ct/u.s)
would mean.
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
Decibel: ten per base 10 logarithmic unit |
\(\mathrm{0.1\,dex}\) |
|
No |
|
Dex: Base 10 logarithmic unit |
No |
||
|
Astronomical magnitude: -2.5 per base 10 logarithmic unit |
\(\mathrm{-0.4\,dex}\) |
Yes |
astropy.units.photometric Module#
This module defines magnitude zero points and related photometric quantities.
The corresponding magnitudes are given in the description of each unit
(the actual definitions are in logarithmic
).
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
AB magnitude zero flux density (magnitude |
\(\mathrm{3.6307805 \times 10^{-20}\,\frac{erg}{Hz\,s\,cm^{2}}}\) |
|
No |
|
Luminosity corresponding to absolute bolometric magnitude zero (magnitude |
\(\mathrm{3.0128 \times 10^{28}\,W}\) |
|
No |
|
Irradiance corresponding to apparent bolometric magnitude zero (magnitude |
\(\mathrm{2.3975101 \times 10^{25}\,\frac{W}{pc^{2}}}\) |
|
No |
|
Maggies - a linear flux unit that is the flux for a mag=0 object.To tie this onto a specific calibrated unit system, the zero_point_flux equivalency should be used. |
|
Yes |
|
|
ST magnitude zero flux density (magnitude |
\(\mathrm{3.6307805 \times 10^{-9}\,\frac{erg}{\mathring{A}\,s\,cm^{2}}}\) |
|
No |
Functions#
|
An equivalency for converting linear flux units ("maggys") defined relative to a standard source into a standardized system. |
astropy.units.imperial Module#
Colloquially used Imperial units.
These units are available in the astropy.units.imperial
namespace, but not in the
top-level astropy.units
namespace, e.g.:
>>> import astropy.units as u
>>> mph = u.imperial.mile / u.hour
>>> mph
Unit("mi / h")
To include them in compose
and the results of
find_equivalent_units
, do:
>>> import astropy.units as u
>>> u.imperial.enable()
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
International acre |
\(\mathrm{43560\,ft^{2}}\) |
|
No |
|
British thermal unit |
\(\mathrm{1.0550559\,kJ}\) |
|
No |
|
Thermochemical calorie: pre-SI metric unit of energy |
\(\mathrm{4.184\,J}\) |
|
No |
|
U.S. |
\(\mathrm{0.5\,pint}\) |
No |
|
|
Degrees Fahrenheit |
|
No |
|
|
Rankine scale: absolute scale of thermodynamic temperature |
|
No |
|
|
U.S. |
\(\mathrm{0.125\,cup}\) |
|
No |
|
International foot |
\(\mathrm{12\,inch}\) |
|
No |
|
Furlong |
\(\mathrm{660\,ft}\) |
|
No |
|
U.S. |
\(\mathrm{3.7854118\,\mathcal{l}}\) |
No |
|
|
Electrical horsepower |
\(\mathrm{745.69987\,W}\) |
|
No |
|
International inch |
\(\mathrm{2.54\,cm}\) |
No |
|
|
Calorie: colloquial definition of Calorie |
\(\mathrm{1000\,cal}\) |
|
No |
|
Kilopound: force |
\(\mathrm{1000\,lbf}\) |
|
No |
|
nautical unit of speed: 1 nmi per hour |
\(\mathrm{\frac{nmi}{h}}\) |
|
No |
|
International avoirdupois pound: mass |
\(\mathrm{16\,oz}\) |
|
No |
|
Pound: force |
\(\mathrm{\frac{ft\,slug}{s^{2}}}\) |
No |
|
|
International mile |
\(\mathrm{5280\,ft}\) |
|
No |
|
Thousandth of an inch |
\(\mathrm{0.001\,inch}\) |
|
No |
|
Nautical mile |
\(\mathrm{1852\,m}\) |
|
No |
|
International avoirdupois ounce: mass |
\(\mathrm{28.349523\,g}\) |
|
No |
|
U.S. |
\(\mathrm{0.5\,quart}\) |
No |
|
|
Pound per square inch: pressure |
\(\mathrm{\frac{lbf}{inch^{2}}}\) |
No |
|
|
U.S. |
\(\mathrm{0.25\,gallon}\) |
No |
|
|
slug: mass |
\(\mathrm{32.174049\,lb}\) |
No |
|
|
International avoirdupois stone: mass |
\(\mathrm{14\,lb}\) |
|
No |
|
U.S. |
\(\mathrm{0.5\,foz}\) |
|
No |
|
International avoirdupois ton: mass |
\(\mathrm{2000\,lb}\) |
No |
|
|
U.S. |
\(\mathrm{0.33333333\,tbsp}\) |
|
No |
|
International yard |
\(\mathrm{3\,ft}\) |
|
No |
astropy.units.cds Module#
This package defines units used in the CDS format, both the units defined in Centre de Données astronomiques de Strasbourg Standards for Astronomical Catalogues 2.0 format and the complete set of supported units. This format is used by VOTable up to version 1.2.
These units are not available in the top-level astropy.units
namespace. To use these units, you must import the astropy.units.cds
module:
>>> from astropy.units import cds
>>> q = 10. * cds.lyr
To include them in compose
and the results of
find_equivalent_units
, do:
>>> from astropy.units import cds
>>> cds.enable()
Note, however, that this can introduce conflicts between CDS and other units in the top-level namespace. A safer way to use CDS units is to enable them inside a context manager. For instance, you could do the following if you have a string that uses CDS units:
>>> import astropy.units as u
>>> unit_string = "mmHg"
>>> with cds.enable():
... pressure_unit = u.Unit(unit_string)
>>> (720*pressure_unit).to(u.bar)
<Quantity 0.95992119 bar>
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
percent |
\(\mathrm{\%}\) |
No |
|
|
dimensionless and unscaled |
\(\mathrm{}\) |
|
No |
|
Planck constant |
\(\mathrm{6.6260701 \times 10^{-34}\,J\,s}\) |
Yes |
|
|
Ampere |
\(\mathrm{A}\) |
Yes |
|
|
year |
\(\mathrm{a}\) |
Yes |
|
|
Bohr radius |
\(\mathrm{5.2917721 \times 10^{-11}\,m}\) |
Yes |
|
|
Angstrom |
\(\mathrm{\mathring{A}}\) |
|
Yes |
|
Light year |
\(\mathrm{lyr}\) |
Yes |
|
|
Fine structure constant |
\(\mathrm{0.0072973526}\) |
Yes |
|
|
minute of arc |
\(\mathrm{{}^{\prime}}\) |
|
Yes |
|
second of arc |
\(\mathrm{{}^{\prime\prime}}\) |
|
Yes |
|
atmosphere |
\(\mathrm{101325\,Pa}\) |
Yes |
|
|
astronomical unit |
\(\mathrm{AU}\) |
|
Yes |
|
bar |
\(\mathrm{bar}\) |
Yes |
|
|
barn |
\(\mathrm{barn}\) |
Yes |
|
|
bit |
\(\mathrm{bit}\) |
Yes |
|
|
byte |
\(\mathrm{byte}\) |
Yes |
|
|
Coulomb |
\(\mathrm{C}\) |
Yes |
|
|
speed of light |
\(\mathrm{2.9979246 \times 10^{8}\,\frac{m}{s}}\) |
Yes |
|
|
calorie |
\(\mathrm{4.1854\,J}\) |
Yes |
|
|
candela |
\(\mathrm{cd}\) |
Yes |
|
|
Crab (X-ray) flux |
Yes |
||
|
count |
\(\mathrm{ct}\) |
Yes |
|
|
Debye (dipole) |
\(\mathrm{D}\) |
Yes |
|
|
Julian day |
\(\mathrm{d}\) |
Yes |
|
|
degree |
\(\mathrm{{}^{\circ}}\) |
|
Yes |
|
dyne |
\(\mathrm{dyn}\) |
Yes |
|
|
electron charge |
\(\mathrm{1.6021766 \times 10^{-19}\,C}\) |
Yes |
|
|
electric constant |
\(\mathrm{8.8541878 \times 10^{-12}\,\frac{F}{m}}\) |
Yes |
|
|
erg |
\(\mathrm{erg}\) |
Yes |
|
|
electron volt |
\(\mathrm{eV}\) |
Yes |
|
|
Farad |
\(\mathrm{F}\) |
Yes |
|
|
Gravitation constant |
\(\mathrm{6.6743 \times 10^{-11}\,\frac{m^{3}}{kg\,s^{2}}}\) |
Yes |
|
|
gram |
\(\mathrm{g}\) |
Yes |
|
|
Gauss |
\(\mathrm{G}\) |
Yes |
|
|
Earth mass |
\(\mathrm{M_{\oplus}}\) |
|
Yes |
|
Henry |
\(\mathrm{H}\) |
Yes |
|
|
hour |
\(\mathrm{h}\) |
Yes |
|
|
hour |
\(\mathrm{h}\) |
Yes |
|
|
Hertz |
\(\mathrm{Hz}\) |
Yes |
|
|
inch |
\(\mathrm{0.0254\,m}\) |
Yes |
|
|
Joule |
\(\mathrm{J}\) |
Yes |
|
|
Julian day |
\(\mathrm{d}\) |
Yes |
|
|
Jupiter mass |
\(\mathrm{M_{\rm J}}\) |
|
Yes |
|
Jansky |
\(\mathrm{Jy}\) |
Yes |
|
|
Kelvin |
\(\mathrm{K}\) |
Yes |
|
|
Boltzmann |
\(\mathrm{1.380649 \times 10^{-23}\,\frac{J}{K}}\) |
Yes |
|
|
litre |
\(\mathrm{\mathcal{l}}\) |
Yes |
|
|
lumen |
\(\mathrm{lm}\) |
Yes |
|
|
solar luminosity |
\(\mathrm{L_{\odot}}\) |
|
Yes |
|
lux |
\(\mathrm{lx}\) |
Yes |
|
|
Light year |
\(\mathrm{lyr}\) |
Yes |
|
|
meter |
\(\mathrm{m}\) |
Yes |
|
|
magnitude |
\(\mathrm{mag}\) |
Yes |
|
|
millisecond of arc |
\(\mathrm{marcsec}\) |
No |
|
|
electron mass |
\(\mathrm{9.1093837 \times 10^{-31}\,kg}\) |
Yes |
|
|
minute |
\(\mathrm{min}\) |
Yes |
|
|
Julian day |
\(\mathrm{d}\) |
Yes |
|
|
millimeter of mercury |
\(\mathrm{133.32239\,Pa}\) |
Yes |
|
|
mole |
\(\mathrm{mol}\) |
Yes |
|
|
proton mass |
\(\mathrm{1.6726219 \times 10^{-27}\,kg}\) |
Yes |
|
|
solar mass |
\(\mathrm{M_{\odot}}\) |
|
Yes |
|
magnetic constant |
\(\mathrm{1.2566371 \times 10^{-6}\,\frac{N}{A^{2}}}\) |
|
Yes |
|
Bohr magneton |
\(\mathrm{9.2740101 \times 10^{-24}\,\frac{J}{T}}\) |
Yes |
|
|
Newton |
\(\mathrm{N}\) |
Yes |
|
|
Ohm |
\(\mathrm{\Omega}\) |
Yes |
|
|
Pascal |
\(\mathrm{Pa}\) |
Yes |
|
|
parsec |
\(\mathrm{pc}\) |
Yes |
|
|
photon |
\(\mathrm{ph}\) |
Yes |
|
|
π |
\(\mathrm{3.1415927}\) |
Yes |
|
|
pixel |
\(\mathrm{pix}\) |
Yes |
|
|
parts per million |
\(\mathrm{1 \times 10^{-6}}\) |
Yes |
|
|
gas constant |
\(\mathrm{8.3144626\,\frac{J}{K\,mol}}\) |
Yes |
|
|
radian |
\(\mathrm{rad}\) |
Yes |
|
|
Earth equatorial radius |
\(\mathrm{6378100\,m}\) |
Yes |
|
|
Jupiter equatorial radius |
\(\mathrm{71492000\,m}\) |
Yes |
|
|
solar radius |
\(\mathrm{R_{\odot}}\) |
|
Yes |
|
Rydberg |
\(\mathrm{R_{\infty}}\) |
Yes |
|
|
Siemens |
\(\mathrm{S}\) |
Yes |
|
|
second |
\(\mathrm{s}\) |
|
Yes |
|
steradian |
\(\mathrm{sr}\) |
Yes |
|
|
solar unit |
\(\mathrm{Sun}\) |
Yes |
|
|
Tesla |
\(\mathrm{T}\) |
Yes |
|
|
metric tonne |
\(\mathrm{1000\,kg}\) |
Yes |
|
|
atomic mass |
\(\mathrm{1.6605391 \times 10^{-27}\,kg}\) |
Yes |
|
|
Volt |
\(\mathrm{V}\) |
Yes |
|
|
Watt |
\(\mathrm{W}\) |
Yes |
|
|
Weber |
\(\mathrm{Wb}\) |
Yes |
|
|
year |
\(\mathrm{a}\) |
Yes |
|
|
microsecond of arc |
\(\mathrm{\mu arcsec}\) |
No |
Functions#
|
Enable CDS units so they appear in results of |
astropy.units.physical Module#
Defines the physical types that correspond to different units.
Physical type |
Unit |
Other physical type(s) with same unit |
---|---|---|
absement |
\(\mathrm{m\,s}\) |
|
absity |
\(\mathrm{s^{2}\,m}\) |
|
acceleration |
\(\mathrm{\frac{m}{s^{2}}}\) |
|
action |
\(\mathrm{\frac{m^{2}\,kg}{s}}\) |
angular momentum |
amount of substance |
\(\mathrm{mol}\) |
|
angle |
\(\mathrm{rad}\) |
|
angular acceleration |
\(\mathrm{\frac{rad}{s^{2}}}\) |
|
angular frequency |
\(\mathrm{\frac{rad}{s}}\) |
angular speed, angular velocity |
angular momentum |
\(\mathrm{\frac{m^{2}\,kg}{s}}\) |
action |
angular speed |
\(\mathrm{\frac{rad}{s}}\) |
angular frequency, angular velocity |
angular velocity |
\(\mathrm{\frac{rad}{s}}\) |
angular frequency, angular speed |
area |
\(\mathrm{m^{2}}\) |
|
bandwidth |
\(\mathrm{\frac{bit}{s}}\) |
|
catalytic activity |
\(\mathrm{\frac{mol}{s}}\) |
|
chemical potential |
\(\mathrm{\frac{J}{mol}}\) |
|
column density |
\(\mathrm{\frac{1}{m^{2}}}\) |
|
compressibility |
\(\mathrm{\frac{1}{Pa}}\) |
|
crackle |
\(\mathrm{\frac{m}{s^{5}}}\) |
|
data quantity |
\(\mathrm{bit}\) |
|
diffusivity |
\(\mathrm{\frac{m^{2}}{s}}\) |
kinematic viscosity |
dimensionless |
\(\mathrm{}\) |
|
dynamic viscosity |
\(\mathrm{\frac{g}{m\,s}}\) |
|
electrical capacitance |
\(\mathrm{F}\) |
|
electrical charge |
\(\mathrm{C}\) |
|
electrical charge (EMU) |
\(\mathrm{abC}\) |
|
electrical charge (ESU) |
\(\mathrm{Fr}\) |
|
electrical charge density |
\(\mathrm{\frac{C}{m^{3}}}\) |
|
electrical conductance |
\(\mathrm{S}\) |
|
electrical conductivity |
\(\mathrm{\frac{S}{m}}\) |
|
electrical current |
\(\mathrm{A}\) |
|
electrical current (EMU) |
\(\mathrm{Bi}\) |
|
electrical current (ESU) |
\(\mathrm{statA}\) |
|
electrical current density |
\(\mathrm{\frac{A}{m^{2}}}\) |
|
electrical dipole moment |
\(\mathrm{C\,m}\) |
|
electrical field strength |
\(\mathrm{\frac{V}{m}}\) |
|
electrical flux density |
\(\mathrm{\frac{C}{m^{2}}}\) |
polarization density, surface charge density |
electrical impedance |
\(\mathrm{\Omega}\) |
electrical reactance, electrical resistance |
electrical mobility |
\(\mathrm{\frac{m^{2}}{V\,s}}\) |
|
electrical potential |
\(\mathrm{V}\) |
|
electrical reactance |
\(\mathrm{\Omega}\) |
electrical impedance, electrical resistance |
electrical resistance |
\(\mathrm{\Omega}\) |
electrical impedance, electrical reactance |
electrical resistivity |
\(\mathrm{\Omega\,m}\) |
|
electromagnetic field strength |
\(\mathrm{\frac{H}{m}}\) |
permeability |
electron density |
\(\mathrm{\frac{e^{-}}{m^{3}}}\) |
|
electron flux |
\(\mathrm{\frac{e^{-}}{s\,m^{2}}}\) |
|
energy |
\(\mathrm{J}\) |
torque, work |
energy density |
\(\mathrm{Pa}\) |
pressure, stress |
energy flux |
\(\mathrm{\frac{J}{s\,m^{2}}}\) |
irradiance |
entropy |
\(\mathrm{\frac{J}{K}}\) |
heat capacity |
force |
\(\mathrm{N}\) |
|
frequency |
\(\mathrm{Hz}\) |
|
frequency drift |
\(\mathrm{\frac{1}{s^{2}}}\) |
|
heat capacity |
\(\mathrm{\frac{J}{K}}\) |
entropy |
illuminance |
\(\mathrm{lx}\) |
luminous emittance |
impulse |
\(\mathrm{\frac{kg\,m}{s}}\) |
momentum |
inductance |
\(\mathrm{H}\) |
|
irradiance |
\(\mathrm{\frac{J}{s\,m^{2}}}\) |
energy flux |
jerk |
\(\mathrm{\frac{m}{s^{3}}}\) |
jolt |
jolt |
\(\mathrm{\frac{m}{s^{3}}}\) |
jerk |
jounce |
\(\mathrm{\frac{m}{s^{4}}}\) |
snap |
kinematic viscosity |
\(\mathrm{\frac{m^{2}}{s}}\) |
diffusivity |
length |
\(\mathrm{m}\) |
|
linear density |
\(\mathrm{\frac{kg}{m}}\) |
|
luminance |
\(\mathrm{\frac{cd}{m^{2}}}\) |
|
luminous efficacy |
\(\mathrm{\frac{lm}{W}}\) |
|
luminous emittance |
\(\mathrm{lx}\) |
illuminance |
luminous flux |
\(\mathrm{lm}\) |
|
luminous intensity |
\(\mathrm{cd}\) |
|
magnetic field strength |
\(\mathrm{\frac{A}{m}}\) |
|
magnetic flux |
\(\mathrm{Wb}\) |
|
magnetic flux density |
\(\mathrm{T}\) |
|
magnetic helicity |
\(\mathrm{Wb^{2}}\) |
|
magnetic moment |
\(\mathrm{m^{2}\,A}\) |
|
magnetic reluctance |
\(\mathrm{\frac{1}{H}}\) |
|
mass |
\(\mathrm{g}\) |
|
mass attenuation coefficient |
\(\mathrm{\frac{m^{2}}{kg}}\) |
opacity |
mass density |
\(\mathrm{\frac{kg}{m^{3}}}\) |
|
mass flux |
\(\mathrm{\frac{kg}{s\,m^{2}}}\) |
momentum density |
molality |
\(\mathrm{\frac{mol}{kg}}\) |
|
molar concentration |
\(\mathrm{\frac{mol}{m^{3}}}\) |
|
molar conductivity |
\(\mathrm{\frac{m^{2}\,S}{mol}}\) |
|
molar heat capacity |
\(\mathrm{\frac{J}{K\,mol}}\) |
|
molar volume |
\(\mathrm{\frac{m^{3}}{mol}}\) |
|
moment of inertia |
\(\mathrm{m^{2}\,kg}\) |
|
momentum |
\(\mathrm{\frac{kg\,m}{s}}\) |
impulse |
momentum density |
\(\mathrm{\frac{kg}{s\,m^{2}}}\) |
mass flux |
number density |
\(\mathrm{\frac{1}{m^{3}}}\) |
|
opacity |
\(\mathrm{\frac{m^{2}}{kg}}\) |
mass attenuation coefficient |
particle flux |
\(\mathrm{\frac{1}{s\,m^{2}}}\) |
|
permeability |
\(\mathrm{\frac{H}{m}}\) |
electromagnetic field strength |
permittivity |
\(\mathrm{\frac{F}{m}}\) |
|
photon flux |
\(\mathrm{R}\) |
|
photon flux density |
\(\mathrm{\frac{ph}{Hz\,s\,cm^{2}}}\) |
|
photon flux density wav |
\(\mathrm{\frac{ph}{\mathring{A}\,s\,cm^{2}}}\) |
|
photon surface brightness |
\(\mathrm{\frac{ph}{Hz\,s\,sr\,cm^{2}}}\) |
|
photon surface brightness wav |
\(\mathrm{\frac{ph}{\mathring{A}\,s\,sr\,cm^{2}}}\) |
|
plate scale |
\(\mathrm{\frac{rad}{m}}\) |
|
polarization density |
\(\mathrm{\frac{C}{m^{2}}}\) |
electrical flux density, surface charge density |
pop |
\(\mathrm{\frac{m}{s^{6}}}\) |
pounce |
pounce |
\(\mathrm{\frac{m}{s^{6}}}\) |
pop |
power |
\(\mathrm{W}\) |
radiant flux |
power density |
\(\mathrm{\frac{J}{s\,m^{3}}}\) |
spectral flux density wav |
pressure |
\(\mathrm{Pa}\) |
energy density, stress |
radiance |
\(\mathrm{\frac{W}{sr\,m^{2}}}\) |
|
radiant flux |
\(\mathrm{W}\) |
power |
radiant intensity |
\(\mathrm{\frac{W}{sr}}\) |
|
reaction rate |
\(\mathrm{\frac{mol}{s\,m^{3}}}\) |
|
snap |
\(\mathrm{\frac{m}{s^{4}}}\) |
jounce |
solid angle |
\(\mathrm{sr}\) |
|
specific energy |
\(\mathrm{\frac{J}{kg}}\) |
|
specific entropy |
\(\mathrm{\frac{J}{K\,kg}}\) |
specific heat capacity |
specific heat capacity |
\(\mathrm{\frac{J}{K\,kg}}\) |
specific entropy |
specific volume |
\(\mathrm{\frac{m^{3}}{kg}}\) |
|
spectral flux density |
\(\mathrm{Jy}\) |
|
spectral flux density wav |
\(\mathrm{\frac{J}{s\,m^{3}}}\) |
power density |
speed |
\(\mathrm{\frac{m}{s}}\) |
velocity |
stress |
\(\mathrm{Pa}\) |
energy density, pressure |
surface brightness |
\(\mathrm{\frac{Jy}{sr}}\) |
|
surface brightness wav |
\(\mathrm{\frac{J}{s\,sr\,m^{3}}}\) |
|
surface charge density |
\(\mathrm{\frac{C}{m^{2}}}\) |
electrical flux density, polarization density |
surface mass density |
\(\mathrm{\frac{kg}{m^{2}}}\) |
|
surface tension |
\(\mathrm{\frac{m^{2}\,W}{Hz}}\) |
|
temperature |
\(\mathrm{K}\) |
|
temperature gradient |
\(\mathrm{\frac{K}{m}}\) |
|
thermal conductance |
\(\mathrm{\frac{W}{K}}\) |
|
thermal conductivity |
\(\mathrm{\frac{W}{K\,m}}\) |
|
thermal resistance |
\(\mathrm{\frac{K}{W}}\) |
|
thermal resistivity |
\(\mathrm{\frac{K\,m}{W}}\) |
|
time |
\(\mathrm{s}\) |
|
torque |
\(\mathrm{J}\) |
energy, work |
velocity |
\(\mathrm{\frac{m}{s}}\) |
speed |
volume |
\(\mathrm{m^{3}}\) |
|
volumetric flow rate |
\(\mathrm{\frac{m^{3}}{s}}\) |
|
volumetric rate |
\(\mathrm{\frac{1}{s\,m^{3}}}\) |
|
wavenumber |
\(\mathrm{\frac{1}{m}}\) |
|
work |
\(\mathrm{J}\) |
energy, torque |
yank |
\(\mathrm{\frac{N}{s}}\) |
Functions#
|
Add a mapping between a unit and the corresponding physical type(s). |
|
Return the physical type that corresponds to a unit (or another physical type representation). |
Classes#
|
Represents the physical type(s) that are dimensionally compatible with a set of units. |
Class Inheritance Diagram#
astropy.units.equivalencies Module#
A set of standard astronomical equivalencies.
Functions#
|
Returns a list of equivalence pairs that handle the conversion between parallax angle and distance. |
|
Returns a list of equivalence pairs that handle spectral wavelength, wave number, frequency, and energy equivalencies. |
|
Returns a list of equivalence pairs that handle spectral density with regard to wavelength and frequency. |
|
Return the equivalency pairs for the radio convention for velocity. |
|
Return the equivalency pairs for the optical convention for velocity. |
|
Return the equivalency pairs for the relativistic convention for velocity. |
Returns the equivalence between Doppler redshift (unitless) and radial velocity. |
|
Returns a list of equivalence pairs that handle the conversion between mass and energy. |
|
|
Defines the conversion between Jy/sr and "brightness temperature", \(T_B\), in Kelvins. |
|
Defines the conversion between Jy/sr and "thermodynamic temperature", \(T_{CMB}\), in Kelvins. |
|
Convert between the |
Allow angles to be equivalent to dimensionless (with 1 rad = 1 m/m = 1). |
|
Allow logarithmic units to be converted to dimensionless fractions. |
|
Convert between Kelvin, Celsius, Rankine and Fahrenheit here because Unit and CompositeUnit cannot do addition or subtraction properly. |
|
Convert between Kelvin and keV(eV) to an equivalent amount. |
|
Returns the equivalence between amu and molar mass. |
|
|
Convert between pixel distances (in units of |
|
Convert between lengths (to be interpreted as lengths in the focal plane) and angular units with a specified |
Classes#
|
A container for a units equivalency. |
Class Inheritance Diagram#
astropy.units.function.core Module#
Function Units and Quantities.
Classes#
|
Abstract base class for function units. |
|
A representation of a (scaled) function of a number with a unit. |
Class Inheritance Diagram#
astropy.units.function.logarithmic Module#
Classes#
|
Logarithmic unit containing a physical one. |
|
Logarithmic physical units expressed in magnitudes. |
|
Logarithmic physical units expressed in magnitudes. |
|
Logarithmic physical units expressed in dB. |
|
A representation of a (scaled) logarithm of a number with a unit. |
|
|
|
|
|
Variables#
Class Inheritance Diagram#
astropy.units.deprecated Module#
This package defines deprecated units.
These units are not available in the top-level astropy.units
namespace. To use these units, you must import the astropy.units.deprecated
module:
>>> from astropy.units import deprecated
>>> q = 10. * deprecated.emu
To include them in compose
and the results of
find_equivalent_units
, do:
>>> from astropy.units import deprecated
>>> deprecated.enable()
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
Biot: CGS (EMU) unit of current |
\(\mathrm{Bi}\) |
No |
|
Prefixes for |
Earth mass prefixes |
\(\mathrm{5.9721679 \times 10^{24}\,kg}\) |
|
Only |
Prefixes for |
Earth radius prefixes |
\(\mathrm{6378100\,m}\) |
|
Only |
Prefixes for |
Jupiter mass prefixes |
\(\mathrm{1.8981246 \times 10^{27}\,kg}\) |
|
Only |
Prefixes for |
Jupiter radius prefixes |
\(\mathrm{71492000\,m}\) |
|
Only |
Functions#
|
Enable deprecated units so they appear in results of |
astropy.units.required_by_vounit Module#
This package defines SI prefixed units that are required by the VOUnit standard
but that are rarely used in practice and liable to lead to confusion (such as
msolMass
for milli-solar mass). They are in a separate module from
astropy.units.deprecated
because they need to be enabled by default for
astropy.units
to parse compliant VOUnit strings. As a result, e.g.,
Unit('msolMass')
will just work, but to access the unit directly, use
astropy.units.required_by_vounit.msolMass
instead of the more typical idiom
possible for the non-prefixed unit, astropy.units.solMass
.
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
Prefixes for |
Solar luminance prefixes |
\(\mathrm{3.828 \times 10^{26}\,W}\) |
|
Only |
Prefixes for |
Solar mass prefixes |
\(\mathrm{1.9884099 \times 10^{30}\,kg}\) |
|
Only |
Prefixes for |
Solar radius prefixes |
\(\mathrm{6.957 \times 10^{8}\,m}\) |
|
Only |