Units (astronat.units
)¶
Reference/API¶
astronat.units Package¶
Astropy Units. Extended.
provides full drop-in replacement for astropy units.
Functions¶
|
Control function return of |
|
Convert AMUSE quantity to astropy quantity. |
|
Change a hms string to Astropy deg units. |
|
Decorator for validating the units of arguments to functions. |
Classes¶
|
Decorator for validating the units of arguments to functions. |
Class Inheritance Diagram¶
astronat.units.composite Module¶
Composite Astropy units.
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
kilometer per second composite unit |
\(\mathrm{\frac{km}{s}}\) |
|
No |
|
kilometer per second per kiloparsec composite unit |
\(\mathrm{\frac{km}{kpc\,s}}\) |
|
No |
|
kilometer per second per Megaparsec composite unit |
\(\mathrm{\frac{km}{Mpc\,s}}\) |
|
No |
|
meter per second composite unit |
\(\mathrm{\frac{m}{s}}\) |
|
No |
|
milli-arcseconds / year composite unit |
\(\mathrm{\frac{mas}{yr}}\) |
|
No |
astronat.units.amuse Module¶
Astropy units, extended for AMUSE compatibility.
These units are also available in the units
namespace.
Not all AMUSE units are compatible with Astropy since some unit names are already present in Astropy. These units are:
ms (meters per second), which in Astropy means milliseconds
myr (million years), which in Astropy means milliyear
This module prioritizes Astropy compatibility, so uses the Astropy versions.
For full AMUSE definitions in astropy units, the
full_amuse
should be used.
Unit |
Description |
Represents |
Aliases |
SI Prefixes |
---|---|---|---|---|
|
ampere: base unit of electric current in SI |
|
No |
|
|
atomic mass unit, AMUSE compatibility |
\(\mathrm{u}\) |
No |
|
|
arc minute: angular measurement |
\(\mathrm{0.016666667\,{}^{\circ}}\) |
|
No |
|
arc second: angular measurement |
\(\mathrm{0.00027777778\,{}^{\circ}}\) |
|
No |
|
astronomical unit: approximately the mean Earth–Sun distance. |
\(\mathrm{1.4959787 \times 10^{11}\,m}\) |
|
No |
|
AU per day, AMUSE compatibility |
\(\mathrm{1.4959787 \times 10^{11}\,\frac{m}{d}}\) |
No |
|
|
coulomb: electric charge |
\(\mathrm{A\,s}\) |
|
No |
|
candela: base unit of luminous intensity in SI |
|
No |
|
|
centimeter (cm) |
\(\mathrm{cm}\) |
|
No |
|
degree: angular measurement 1/360 of full rotation |
\(\mathrm{0.017453293\,rad}\) |
|
No |
|
electron charge, AMUSE compatibility |
\(\mathrm{1.6021766 \times 10^{-19}\,C}\) |
No |
|
|
Hartree energy, AMUSE compatibility |
\(\mathrm{2\,R_{\infty}}\) |
|
No |
|
erg: CGS unit of energy |
\(\mathrm{\frac{cm^{2}\,g}{s^{2}}}\) |
No |
|
|
Electron Volt |
\(\mathrm{1.6021766 \times 10^{-19}\,J}\) |
|
Yes |
|
Farad: electrical capacitance |
\(\mathrm{\frac{C}{V}}\) |
|
No |
|
gram (g) |
\(\mathrm{0.001\,kg}\) |
|
No |
|
billion years, AMUSE compatibility. |
\(\mathrm{Gyr}\) |
No |
|
|
Frequency |
\(\mathrm{\frac{1}{s}}\) |
|
Yes |
|
Joule: energy |
\(\mathrm{N\,m}\) |
|
No |
|
julian year, AMUSE compatibility |
\(\mathrm{365.25\,d}\) |
No |
|
|
Kelvin: temperature with a null point at absolute zero. |
|
No |
|
|
Kelvin, AMUSE compatibility |
\(\mathrm{K}\) |
No |
|
|
kilogram: base unit of mass in SI. |
|
No |
|
|
kilometer per seconds, AMUSE compatibility |
\(\mathrm{\frac{km}{s}}\) |
No |
|
|
solar luminosity, AMUSE compatibility |
\(\mathrm{L_{\odot}}\) |
No |
|
|
light year, AMUSE compatibility |
\(\mathrm{lyr}\) |
No |
|
|
meter: base unit of length in SI |
|
No |
|
|
Jupiter mass, AMUSE compatibility |
\(\mathrm{M_{\oplus}}\) |
No |
|
|
metallicity: base unit of metallicity in AMUSE |
Yes |
||
|
Jupiter mass, AMUSE compatibility |
\(\mathrm{M_{\rm J}}\) |
No |
|
|
mole: amount of a chemical substance in SI. |
|
No |
|
|
solar mass, AMUSE compatibility |
\(\mathrm{M_{\odot}}\) |
No |
|
|
Newton: force |
\(\mathrm{\frac{kg\,m}{s^{2}}}\) |
|
No |
|
object_key: base particle key unit in AMUSE |
Yes |
||
|
Pascal: pressure |
\(\mathrm{\frac{J}{m^{3}}}\) |
|
No |
|
parsec: approximately 3.26 light-years. |
\(\mathrm{3.0856776 \times 10^{16}\,m}\) |
|
Yes |
|
percent: one hundredth of unity, factor 0.01 |
\(\mathrm{0.01\,}\) |
|
No |
|
pi radians, AMUSE compatibility |
\(\mathrm{3.1415927\,rad}\) |
No |
|
|
radian: angular measurement of the ratio between the length on an arc and its radius |
|
No |
|
|
Jupiter radius, AMUSE compatibility |
\(\mathrm{R_{\oplus}}\) |
No |
|
|
revolutions, AMUSE compatibility |
\(\mathrm{6.2831853\,rad}\) |
No |
|
|
Jupiter radius, AMUSE compatibility |
\(\mathrm{R_{\rm J}}\) |
No |
|
|
solar radius, AMUSE compatibility |
\(\mathrm{R_{\odot}}\) |
No |
|
|
Rydberg: Energy of a photon whose wavenumber is the Rydberg constant |
\(\mathrm{13.605693\,eV}\) |
|
No |
|
second: base unit of time in SI. |
|
No |
|
|
Siemens: electrical conductance |
\(\mathrm{\frac{A}{V}}\) |
|
No |
|
steradian: unit of solid angle in SI |
\(\mathrm{rad^{2}}\) |
|
No |
|
stellar_type: base stellar type unit in AMUSE |
Yes |
||
|
string: base string unit in AMUSE |
Yes |
||
|
Tesla: magnetic flux density |
\(\mathrm{\frac{Wb}{m^{2}}}\) |
|
No |
|
Volt: electric potential or electromotive force |
\(\mathrm{\frac{J}{C}}\) |
|
No |
|
Watt: power |
\(\mathrm{\frac{J}{s}}\) |
|
No |
|
Weber: magnetic flux |
\(\mathrm{V\,s}\) |
|
No |
|
year (yr) |
\(\mathrm{365.25\,d}\) |
|
Yes |
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¶
|
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. |
|
Adds a new physical unit mapping. |
|
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. |
|
Return the equivalency pairs for the relativistic convention for velocity. |
|
Given a unit, returns the name of the physical quantity it represents. |
|
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. |
|
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 equivalences. |
|
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. |
|
Convert between quantities with little-h and the equivalent physical units. |
|
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 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. |
|
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. |
|
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 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. |