参考/API#

astropy.units.数量模块#

此模块定义 Quantity 对象,它表示具有某些关联单位的数字。 Quantity 对象支持与普通数类似的操作,但将在内部处理单位转换。

功能#

allclose(a, b[, rtol, atol, equal_nan])

两个数组在一个公差内是否元素相等。

isclose(a, b[, rtol, atol, equal_nan])

返回一个布尔数组,其中两个数组在一个公差内元素上相等。

Classes#

Quantity(value[, unit, dtype, copy, order, ...])

A Quantity 表示具有某个关联单位的数字。

SpecificTypeQuantity(value[, unit, dtype, ...])

特定物理类型数量的超类。

QuantityInfoBase([bound])

QuantityInfo([bound])

用于存储诸如名称、描述、格式等元信息的容器。

类继承图#

Inheritance diagram of astropy.units.quantity.Quantity, astropy.units.quantity.SpecificTypeQuantity, astropy.units.quantity.QuantityInfoBase, astropy.units.quantity.QuantityInfo

astropy.units 包#

此子包包含用于定义和转换不同物理单元的类和函数。

此代码改编自 pynbody units模块由andrewpontzen编写,他已经授予Astropy项目使用BSD许可证下的代码的权限。

功能#

add_enabled_aliases \(别名)

为设备添加别名。

add_enabled_equivalencies \(等价物)

添加到单位注册表中启用的等效项。

add_enabled_units \(单位)

添加到在单位注册表中启用的单位集。

allclose(a, b[, rtol, atol, equal_nan])

两个数组在一个公差内是否元素相等。

beam_angular_area(beam_area)

beam 单位,通常用来表示射电望远镜分辨率元素的面积和天空中的面积。

brightness_temperature(frequency[, beam_area])

定义Jy/sr和“亮度温度”之间的转换, \(T_B\) ,在凯尔文。

def_physical_type(unit, name)

添加设备和相应物理类型之间的映射。

def_unit(s[, represents, doc, format, ...])

定义新单位的工厂函数。

dimensionless_angles \()

允许角度等于无量纲(1 rad=1 m/m=1)。

doppler_optical \(休息)

返回速度光学约定的等效对。

doppler_radio \(休息)

返回速率的无线电约定的等效对。

doppler_redshift \()

返回多普勒红移(无单位)和径向速度之间的等值。

doppler_relativistic \(休息)

返回速度的相对论性约定的等价对。

get_current_unit_registry \()

get_physical_type \(OBJ)

返回与一个单元(或另一个物理类型表示)对应的物理类型。

isclose(a, b[, rtol, atol, equal_nan])

返回一个布尔数组,其中两个数组在一个公差内元素上相等。

logarithmic \()

允许将对数单位转换为无因次分数。

mass_energy \()

返回处理质量和能量之间转换的等价对列表。

molar_mass_amu \()

返回amu和摩尔质量之间的等效值。

parallax \()

返回处理视差角度和距离之间转换的等效对列表。

pixel_scale \(像素比例)

在像素距离之间转换(单位为 pix )以及其他单位 pixscale .

plate_scale \(平台刻度)

在长度(被解释为焦平面中的长度)和角度单位之间转换 platescale .

quantity_input([func])

用于验证函数参数单位的修饰符。

set_enabled_aliases \(别名)

设置设备的别名。

set_enabled_equivalencies \(等价物)

设置在单元注册表中启用的等效项。

set_enabled_units \(单位)

设置单位注册表中启用的单位。

spectral \()

返回处理光谱波长、波数、频率和能量等效的等效对的列表。

spectral_density(wav[, factor])

返回处理与波长和频率有关的光谱密度的等效对列表。

temperature \()

在这里转换开尔文、摄氏度、兰金和华氏度,因为单位和合成单位不能正确地进行加减运算。

temperature_energy \()

在开尔文和keV(eV)之间换算成相等的量。

thermodynamic_temperature(frequency[, T_cmb])

定义了Jy/sr和“热力学温度”之间的转换, \(T_{{CMB}}\) ,在凯尔文。

zero_point_flux \(磁通0)

将相对于标准源定义的线性通量单位(“maggys”)转换为标准化系统的等效性。

Classes#

CompositeUnit(scale, bases, powers[, ...])

使用先前定义的单位表达式创建一个复合单位。

Decibel(value[, unit, dtype, copy, order, ...])

DecibelUnit([physical_unit, function_unit])

以分贝表示的对数物理单位。

Dex(value[, unit, dtype, copy, order, ...])

DexUnit([physical_unit, function_unit])

以量级表示的对数物理单位。

Equivalency(equiv_list[, name, kwargs])

单位等价物的容器。

FunctionQuantity(value[, unit, dtype, copy, ...])

用单位表示一个数的(标度)函数。

FunctionUnitBase([physical_unit, function_unit])

函数单元的抽象基类。

IrreducibleUnit(st[, doc, format, namespace])

不可约单位是所有其他单位的定义单位。

LogQuantity(value[, unit, dtype, copy, ...])

一个数与一个单位的(标度)对数的表示。

LogUnit([physical_unit, function_unit])

包含一个物理单位的对数单位。

MagUnit([physical_unit, function_unit])

以量级表示的对数物理单位。

Magnitude(value[, unit, dtype, copy, order, ...])

NamedUnit(st[, doc, format, namespace])

具有名称的单元的基类。

PhysicalType(unit, physical_types)

表示在尺寸上与一组单位兼容的物理类型。

PrefixUnit([s, represents, format, ...])

一种单位,它只是另一个单位的SI前缀形式。

Quantity(value[, unit, dtype, copy, order, ...])

A Quantity 表示具有某个关联单位的数字。

QuantityInfo([bound])

用于存储诸如名称、描述、格式等元信息的容器。

QuantityInfoBase([bound])

SpecificTypeQuantity(value[, unit, dtype, ...])

特定物理类型数量的超类。

StructuredUnit(units[, names])

结构数量单位的容器。

Unit([s, represents, format, namespace, ...])

主单元类。

UnitBase \()

单位的抽象基类。

UnitConversionError 

专门用于与单位之间转换或根据其他单位解释单位有关的错误。

UnitTypeError 

专门用于设置类不允许的单位时出现的错误。

UnitsError 

特定于单元的异常的基类。

UnitsWarning 

单元特定警告的基类。

UnrecognizedUnit(st[, doc, format, namespace])

不能正确解析的单元。

类继承图#

Inheritance diagram of astropy.units.core.CompositeUnit, astropy.units.function.logarithmic.Decibel, astropy.units.function.logarithmic.DecibelUnit, astropy.units.function.logarithmic.Dex, astropy.units.function.logarithmic.DexUnit, astropy.units.equivalencies.Equivalency, astropy.units.function.core.FunctionQuantity, astropy.units.function.core.FunctionUnitBase, astropy.units.core.IrreducibleUnit, astropy.units.function.logarithmic.LogQuantity, astropy.units.function.logarithmic.LogUnit, astropy.units.function.logarithmic.MagUnit, astropy.units.function.logarithmic.Magnitude, astropy.units.core.NamedUnit, astropy.units.physical.PhysicalType, astropy.units.core.PrefixUnit, astropy.units.quantity.Quantity, astropy.units.quantity.QuantityInfo, astropy.units.quantity.QuantityInfoBase, astropy.units.quantity.SpecificTypeQuantity, astropy.units.structured.StructuredUnit, astropy.units.core.Unit, astropy.units.core.UnitBase, astropy.units.core.UnitConversionError, astropy.units.core.UnitTypeError, astropy.units.core.UnitsError, astropy.units.core.UnitsWarning, astropy.units.core.UnrecognizedUnit

astropy.units.format包裹#

不同单位格式的集合。

功能#

get_format([format])

按名称获取格式化程序。

Classes#

Base(*args, **kwargs)

所有单元格式的抽象基类。

Generic(*args, **kwargs)

“通用”格式。

CDS(*args, **kwargs)

支持 Centre de Données astronomiques de Strasbourg Standards for Astronomical Catalogues 2.0 格式,并且 complete set of supported units

Console(*args, **kwargs)

仅输出格式,以便在控制台上显示漂亮的格式。

Fits(*args, **kwargs)

符合标准单位格式。

Latex(*args, **kwargs)

根据IAU风格指南输出LaTeX以显示设备。

LatexInline(*args, **kwargs)

输出 Latex 显示单位基于IAU风格的指导方针与负功率。

OGIP(*args, **kwargs)

支援部队 Office of Guest Investigator Programs (OGIP) FITS files .

Unicode(*args, **kwargs)

只输出格式,以便在控制台上使用Unicode字符显示漂亮的格式。

Unscaled(*args, **kwargs)

自 5.3 版本弃用.

VOUnit(*args, **kwargs)

VO使用的单位的IVOA标准。

类继承图#

Inheritance diagram of astropy.units.format.base.Base, astropy.units.format.generic.Generic, astropy.units.format.cds.CDS, astropy.units.format.console.Console, astropy.units.format.fits.Fits, astropy.units.format.latex.Latex, astropy.units.format.latex.LatexInline, astropy.units.format.ogip.OGIP, astropy.units.format.unicode_format.Unicode, astropy.units.format.generic.Unscaled, astropy.units.format.vounit.VOUnit

astropy.units.si模块#

此软件包定义了国际单位制。它们也可以在 astropy.units 命名空间。

可用单位#

单位

描述

代表

别名

SI前缀

a

年(a)

\(\mathrm{365.25\,d}\)

annum

是的

A

安培:国际单位制电流的基本单位

ampere, amp

是的

Angstrom

ångström:10**-10米

\(\mathrm{0.1\,nm}\)

AA, angstrom

是的

arcmin

弧分:角度测量

\(\mathrm{0.016666667\,{}^{\circ}}\)

arcminute

是的

arcsec

弧秒:角度测量

\(\mathrm{0.00027777778\,{}^{\circ}}\)

arcsecond

是的

Bq

贝克勒尔:放射性单位

\(\mathrm{\frac{1}{s}}\)

becquerel

C

库仑:电荷

\(\mathrm{A\,s}\)

coulomb

是的

cd

坎德拉:以国际单位制表示的发光强度的基本单位

candela

是的

Ci

居里:放射性单位

\(\mathrm{3.7 \times 10^{10}\,Bq}\)

curie

cm

厘米:国际单位为0.01米,CGS为基本长度单位

\(\mathrm{0.01\,m}\)

centimeter

d

天(d)

\(\mathrm{24\,h}\)

day

是的

deg

度:角度测量1/360全旋转

\(\mathrm{0.017453293\,rad}\)

degree

是的

deg_C

摄氏度

Celsius

eV

电子伏特

\(\mathrm{1.6021766 \times 10^{-19}\,J}\)

electronvolt

是的

F

法拉德:电容

\(\mathrm{\frac{C}{V}}\)

Farad, farad

是的

fortnight

两星期

\(\mathrm{2\,wk}\)

g

克(g)

\(\mathrm{0.001\,kg}\)

gram

是的

h

小时(h)

\(\mathrm{3600\,s}\)

hour, hr

是的

H

亨利:电感

\(\mathrm{\frac{Wb}{A}}\)

Henry, henry

是的

hourangle

小时角:全圆24度角测量

\(\mathrm{15\,{}^{\circ}}\)

Hz

频率

\(\mathrm{\frac{1}{s}}\)

Hertz, hertz

是的

J

焦耳:能量

\(\mathrm{N\,m}\)

Joule, joule

是的

K

开尔文:零点在绝对零度的温度。

Kelvin

是的

kg

千克:国际单位制的基本质量单位。

kilogram

l

升:公制体积单位

\(\mathrm{1000\,cm^{3}}\)

L, liter

是的

lm

流明:光通量

\(\mathrm{cd\,sr}\)

lumen

是的

lx

勒克斯:发光度

\(\mathrm{\frac{lm}{m^{2}}}\)

lux

是的

m

米:长度的基本单位,国际单位制

meter

是的

mas

微弧秒:角度测量

\(\mathrm{0.001\,{}^{\prime\prime}}\)

micron

微米:微米的别名(um)

\(\mathrm{\mu m}\)

min

分钟(min)

\(\mathrm{60\,s}\)

minute

是的

mol

摩尔:化学物质在国际单位制中的数量。

mole

是的

N

牛顿:力

\(\mathrm{\frac{kg\,m}{s^{2}}}\)

Newton, newton

是的

Ohm

欧姆:电阻

\(\mathrm{\frac{V}{A}}\)

ohm

是的

Pa

帕斯卡:压力

\(\mathrm{\frac{J}{m^{3}}}\)

Pascal, pascal

是的

%

百分比:百分之一,系数0.01

\(\mathrm{0.01}\)

pct

rad

弧度:用角度量度一段弧的长度与半径之比

radian

是的

s

第二:国际单位制的基本时间单位。

second

是的

S

西门子:电导

\(\mathrm{\frac{A}{V}}\)

Siemens, siemens

是的

sday

恒星日(sday)是地球自转一周的时间。

\(\mathrm{86164.091\,s}\)

sr

甾体:国际单位制的立体角单位

\(\mathrm{rad^{2}}\)

steradian

是的

t

公吨

\(\mathrm{1000\,kg}\)

tonne

T

磁通量密度

\(\mathrm{\frac{Wb}{m^{2}}}\)

Tesla, tesla

是的

uas

微弧秒:角度测量

\(\mathrm{1 \times 10^{-6}\,{}^{\prime\prime}}\)

V

伏:电势或电动势

\(\mathrm{\frac{J}{C}}\)

Volt, volt

是的

W

瓦特:功率

\(\mathrm{\frac{J}{s}}\)

Watt, watt

是的

Wb

韦伯:磁通量

\(\mathrm{V\,s}\)

Weber, weber

是的

wk

周(周)

\(\mathrm{7\,d}\)

week

yr

年(年)

\(\mathrm{365.25\,d}\)

year

是的

astropy.units.cgs模块#

这个包定义了CGS单元。它们也可以在顶层使用 astropy.units 命名空间。

可用单位#

单位

描述

代表

别名

SI前缀

abC

abcoulomb:电荷的CGS(EMU)

\(\mathrm{Bi\,s}\)

abcoulomb

Ba

巴耶:CGS压力单位

\(\mathrm{\frac{g}{cm\,s^{2}}}\)

Barye, barye

是的

Bi

比奥:CGS(EMU)电流单位

\(\mathrm{\frac{cm^{1/2}\,g^{1/2}}{s}}\)

Biot, abA, abampere

C

库仑:电荷

\(\mathrm{A\,s}\)

coulomb

cd

坎德拉:以国际单位制表示的发光强度的基本单位

candela

cm

厘米:国际单位为0.01米,CGS为基本长度单位

\(\mathrm{0.01\,m}\)

centimeter

D

德拜:电偶极矩的CGS单位

\(\mathrm{3.3333333 \times 10^{-30}\,C\,m}\)

Debye, debye

是的

deg_C

摄氏度

Celsius

dyn

dyne:CGS力单位

\(\mathrm{\frac{cm\,g}{s^{2}}}\)

dyne

是的

erg

erg:CGS能量单位

\(\mathrm{\frac{cm^{2}\,g}{s^{2}}}\)

是的

Fr

富兰克林:CGS(ESU)计费单位

\(\mathrm{\frac{cm^{3/2}\,g^{1/2}}{s}}\)

Franklin, statcoulomb, statC, esu

g

克(g)

\(\mathrm{0.001\,kg}\)

gram

G

高斯:磁场的CGS单位

\(\mathrm{0.0001\,T}\)

Gauss, gauss

是的

Gal

Gal:CGS加速度单位

\(\mathrm{\frac{cm}{s^{2}}}\)

gal

是的

K

开尔文:零点在绝对零度的温度。

Kelvin

k

凯瑟:波数的CGS单位

\(\mathrm{\frac{1}{cm}}\)

Kayser, kayser

是的

mol

摩尔:化学物质在国际单位制中的数量。

mole

Mx

麦克斯韦:CGS磁通量单位

\(\mathrm{1 \times 10^{-8}\,Wb}\)

Maxwell, maxwell

P

泊:动态粘度的CGS单位

\(\mathrm{\frac{g}{cm\,s}}\)

poise

是的

rad

弧度:用角度量度一段弧的长度与半径之比

radian

s

第二:国际单位制的基本时间单位。

second

sr

甾体:国际单位制的立体角单位

\(\mathrm{rad^{2}}\)

steradian

St

斯托克斯:运动粘度的CGS单位

\(\mathrm{\frac{cm^{2}}{s}}\)

stokes

是的

statA

斯塔坦佩雷:CGS(ESU)电流单位

\(\mathrm{\frac{Fr}{s}}\)

statampere

astropy.units.astrophys公司模块#

这个软件包定义了天体物理学的特定单位。它们也可以在 astropy.units 命名空间。

可用单位#

单位

描述

代表

别名

SI前缀

adu

阿杜

是的

AU

天文单位:近似地球-太阳的平均距离。

\(\mathrm{1.4959787 \times 10^{11}\,m}\)

au, astronomical_unit

是的

beam

是的

bin

箱子

是的

chan

是的

ct

计数(ct)

count

是的

DN

DN(DN)

dn

earthMass

地球质量

\(\mathrm{5.9721679 \times 10^{24}\,kg}\)

M_earth, Mearth

earthRad

地球半径

\(\mathrm{6378100\,m}\)

R_earth, Rearth

electron

电子数

jupiterMass

木星质量

\(\mathrm{1.8981246 \times 10^{27}\,kg}\)

M_jup, Mjup, M_jupiter, Mjupiter

jupiterRad

木星半径

\(\mathrm{71492000\,m}\)

R_jup, Rjup, R_jupiter, Rjupiter

Jy

詹斯基:光谱通量密度

\(\mathrm{1 \times 10^{-26}\,\frac{W}{Hz\,m^{2}}}\)

Jansky, jansky

是的

lsec

光秒

\(\mathrm{2.9979246 \times 10^{8}\,m}\)

lightsecond

lyr

光年

\(\mathrm{9.4607305 \times 10^{15}\,m}\)

lightyear

是的

pc

帕塞克:大约3.26光年。

\(\mathrm{3.0856776 \times 10^{16}\,m}\)

parsec

是的

ph

光子(ph)

photon

是的

R

瑞利:光子通量

\(\mathrm{7.9577472 \times 10^{8}\,\frac{ph}{s\,sr\,m^{2}}}\)

Rayleigh, rayleigh

是的

Ry

里德堡:波数为里德堡常数的光子的能量

\(\mathrm{13.605693\,eV}\)

rydberg

是的

solLum

太阳亮度

\(\mathrm{3.828 \times 10^{26}\,W}\)

L_sun, Lsun

solMass

太阳质量

\(\mathrm{1.9884099 \times 10^{30}\,kg}\)

M_sun, Msun

solRad

太阳半径

\(\mathrm{6.957 \times 10^{8}\,m}\)

R_sun, Rsun

Sun

太阳

Asterpy.units.misc模块#

此程序包定义了其他单位。它们也可以在 astropy.units 命名空间。

可用单位#

单位

描述

代表

别名

SI前缀

bar

巴:压力

\(\mathrm{100000\,Pa}\)

是的

barn

谷仓:HEP使用的面积单位

\(\mathrm{1 \times 10^{-28}\,m^{2}}\)

barn

是的

bit

b(位)

b

是的

byte

B(字节)

\(\mathrm{8\,bit}\)

B

是的

cycle

周期:角度测量,一个完整的旋转或旋转

\(\mathrm{6.2831853\,rad}\)

cy

M_e

电子质量

\(\mathrm{9.1093837 \times 10^{-31}\,kg}\)

M_p

质子质量

\(\mathrm{1.6726219 \times 10^{-27}\,kg}\)

pix

像素(像素)

pixel

是的

spat

spat:球体的立体角,4pi sr

\(\mathrm{12.566371\,sr}\)

sp

Torr

现在定义的绝对气压单位是760/a

\(\mathrm{133.32237\,Pa}\)

torr

是的

u

统一原子质量单位

\(\mathrm{1.6605391 \times 10^{-27}\,kg}\)

Da, Dalton

是的

vox

体素

voxel

是的

astropy.units.function.函数.单元模块#

这个包定义了也可以作为其他单元的函数使用的单元。如果被调用,它们的参数用于初始化相应的功能单元(例如。, u.mag(u.ct/u.s) ). 请注意,不能调用带前缀的版本,因为不清楚是什么,例如。, u.mmag(u.ct/u.s) 意味着。

可用单位#

单位

描述

代表

别名

SI前缀

dB

分贝:每以10为基数的对数单位为10

\(\mathrm{0.1\,dex}\)

decibel

dex

Dex:以10为底的对数单位

mag

天文震级:每10个对数单位为2.5

\(\mathrm{-0.4\,dex}\)

是的

astropy.units.光度学模块#

本模块定义幅值零点和相关光度控制量。

每个单元的描述中给出了相应的震级(实际定义见 logarithmic

可用单位#

单位

描述

代表

别名

SI前缀

AB

AB magnitude零磁通密度(magnitude ABmag

\(\mathrm{3.6307805 \times 10^{-20}\,\frac{erg}{Hz\,s\,cm^{2}}}\)

ABflux

Bol

对应于绝对热计量震级0(量级)的光度 M_bol

\(\mathrm{3.0128 \times 10^{28}\,W}\)

L_bol

bol

对应于appparent热计量震级0(震级)的辐照度 m_bol

\(\mathrm{2.3975101 \times 10^{25}\,\frac{W}{pc^{2}}}\)

f_bol

mgy

磁通量的线性单位是对象。到将其连接到特定的校准单位系统上,应使用零点通量当量。

maggy

是的

ST

ST magnitude零磁通密度(magnitude STmag

\(\mathrm{3.6307805 \times 10^{-9}\,\frac{erg}{\mathring{A}\,s\,cm^{2}}}\)

STflux

功能#

zero_point_flux \(磁通0)

将相对于标准源定义的线性通量单位(“maggys”)转换为标准化系统的等效性。

astropy.units.英制模块#

通俗使用的英制单位。

这些部件可在 astropy.units.imperial 命名空间,但不在顶级 astropy.units 命名空间,例如::

>>> import astropy.units as u
>>> mph = u.imperial.mile / u.hour
>>> mph
Unit("mi / h")

把他们包括在 compose 以及 find_equivalent_units DO::

>>> import astropy.units as u
>>> u.imperial.enable()  
可用单位#

单位

描述

代表

别名

SI前缀

ac

国际英亩

\(\mathrm{43560\,ft^{2}}\)

acre

BTU

英制热量单位

\(\mathrm{1.0550559\,kJ}\)

btu

cal

热化学热量:前国际单位制的能量单位

\(\mathrm{4.184\,J}\)

calorie

cup

U、 美国。

\(\mathrm{0.5\,pint}\)

deg_F

华氏度

Fahrenheit

deg_R

朗肯标度:热力学温度的绝对标度

Rankine

foz

U、 美国。

\(\mathrm{0.125\,cup}\)

fluid_oz, fluid_ounce

ft

国际脚

\(\mathrm{12\,inch}\)

foot

fur

弗隆

\(\mathrm{660\,ft}\)

furlong

gallon

U、 美国。

\(\mathrm{3.7854118\,\mathcal{l}}\)

hp

电马力

\(\mathrm{745.69987\,W}\)

horsepower

inch

国际英寸

\(\mathrm{2.54\,cm}\)

kcal

卡路里:对卡路里的俗语定义

\(\mathrm{1000\,cal}\)

Cal, Calorie, kilocal, kilocalorie

kip

千磅:力

\(\mathrm{1000\,lbf}\)

kilopound

kn

航海速度单位:每小时1海里

\(\mathrm{\frac{nmi}{h}}\)

kt, knot, NMPH

lb

国际单位磅:质量

\(\mathrm{16\,oz}\)

lbm, pound

lbf

Pound:力

\(\mathrm{\frac{ft\,slug}{s^{2}}}\)

mi

国际英里

\(\mathrm{5280\,ft}\)

mile

mil

千分之一英寸

\(\mathrm{0.001\,inch}\)

thou

nmi

海里

\(\mathrm{1852\,m}\)

nauticalmile, NM

oz

国际重量级盎司:质量

\(\mathrm{28.349523\,g}\)

ounce

pint

U、 美国。

\(\mathrm{0.5\,quart}\)

psi

磅/平方英寸:压力

\(\mathrm{\frac{lbf}{inch^{2}}}\)

quart

U、 美国。

\(\mathrm{0.25\,gallon}\)

slug

弹头:质量

\(\mathrm{32.174049\,lb}\)

st

国际重量级宝石:质量

\(\mathrm{14\,lb}\)

stone

tbsp

U、 美国。

\(\mathrm{0.5\,foz}\)

tablespoon

ton

国际单位吨:质量

\(\mathrm{2000\,lb}\)

tsp

U、 美国。

\(\mathrm{0.33333333\,tbsp}\)

teaspoon

yd

国际货场

\(\mathrm{3\,ft}\)

yard

功能#

enable \()

启用英制单位,使其显示在结果中 find_equivalent_unitscompose .

cds.astropy单位模块#

此程序包定义了CDS格式中使用的单位,这两个单位都是 Centre de Données astronomiques de Strasbourg Standards for Astronomical Catalogues 2.0 格式和 complete set of supported units 。VOTABLE直到1.2版都使用此格式。

这些单元在顶级中不可用 astropy.units 命名空间。要使用这些单位,必须导入 astropy.units.cds 模块:

>>> from astropy.units import cds
>>> q = 10. * cds.lyr  

把他们包括在 compose 以及 find_equivalent_units DO::

>>> from astropy.units import cds
>>> cds.enable()  

但是,请注意,这可能会在CDS和顶级命名空间中的其他单元之间引入冲突。使用CDS单元的一种更安全的方法是在上下文管理器中启用它们。例如,如果您有一个使用CDS单位的字符串,则可以执行以下操作:

>>> 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>
可用单位#

单位

描述

代表

别名

SI前缀

%

百分比

\(\mathrm{\%}\)

---

无量纲无标度

\(\mathrm{}\)

-

\h

普朗克常数

\(\mathrm{6.6260701 \times 10^{-34}\,J\,s}\)

是的

A

安培

\(\mathrm{A}\)

是的

a

\(\mathrm{a}\)

是的

a0

玻尔半径

\(\mathrm{5.2917721 \times 10^{-11}\,m}\)

是的

AA

\(\mathrm{\mathring{A}}\)

Å, Angstrom, Angstroem

是的

al

光年

\(\mathrm{lyr}\)

是的

alpha

精细结构常数

\(\mathrm{0.0072973526}\)

是的

arcmin

弧分

\(\mathrm{{}^{\prime}}\)

arcm

是的

arcsec

弧秒

\(\mathrm{{}^{\prime\prime}}\)

arcs

是的

atm

气氛

\(\mathrm{101325\,Pa}\)

是的

AU

天文单位

\(\mathrm{AU}\)

au

是的

bar

酒吧

\(\mathrm{bar}\)

是的

barn

谷仓

\(\mathrm{barn}\)

是的

bit

一点

\(\mathrm{bit}\)

是的

byte

字节

\(\mathrm{byte}\)

是的

C

库仑

\(\mathrm{C}\)

是的

c

光速

\(\mathrm{2.9979246 \times 10^{8}\,\frac{m}{s}}\)

是的

cal

卡路里

\(\mathrm{4.1854\,J}\)

是的

cd

坎德拉

\(\mathrm{cd}\)

是的

Crab

蟹状(X射线)通量

是的

ct

计数

\(\mathrm{ct}\)

是的

D

德拜(偶极子)

\(\mathrm{D}\)

是的

d

朱利安节

\(\mathrm{d}\)

是的

deg

\(\mathrm{{}^{\circ}}\)

°, degree

是的

dyn

达因

\(\mathrm{dyn}\)

是的

e

电子电荷

\(\mathrm{1.6021766 \times 10^{-19}\,C}\)

是的

eps0

电常数

\(\mathrm{8.8541878 \times 10^{-12}\,\frac{F}{m}}\)

是的

erg

erg公司

\(\mathrm{erg}\)

是的

eV

电子伏特

\(\mathrm{eV}\)

是的

F

法拉德

\(\mathrm{F}\)

是的

G

引力常数

\(\mathrm{6.6743 \times 10^{-11}\,\frac{m^{3}}{kg\,s^{2}}}\)

是的

g

\(\mathrm{g}\)

是的

gauss

高斯

\(\mathrm{G}\)

是的

geoMass

地球质量

\(\mathrm{M_{\oplus}}\)

Mgeo

是的

H

亨利

\(\mathrm{H}\)

是的

h

小时

\(\mathrm{h}\)

是的

hr

小时

\(\mathrm{h}\)

是的

Hz

赫兹

\(\mathrm{Hz}\)

是的

inch

英寸

\(\mathrm{0.0254\,m}\)

是的

J

焦耳

\(\mathrm{J}\)

是的

JD

朱利安节

\(\mathrm{d}\)

是的

jovMass

木星质量

\(\mathrm{M_{\rm J}}\)

Mjup

是的

Jy

詹斯基

\(\mathrm{Jy}\)

是的

K

开尔文

\(\mathrm{K}\)

是的

k

玻尔兹曼

\(\mathrm{1.380649 \times 10^{-23}\,\frac{J}{K}}\)

是的

l

\(\mathrm{\mathcal{l}}\)

是的

lm

流明

\(\mathrm{lm}\)

是的

Lsun

太阳光度

\(\mathrm{L_{\odot}}\)

solLum

是的

lx

勒克斯

\(\mathrm{lx}\)

是的

lyr

光年

\(\mathrm{lyr}\)

是的

m

\(\mathrm{m}\)

是的

mag

震级

\(\mathrm{mag}\)

是的

mas

毫秒弧

\(\mathrm{marcsec}\)

me

电子质量

\(\mathrm{9.1093837 \times 10^{-31}\,kg}\)

是的

min

分钟

\(\mathrm{min}\)

是的

MJD

朱利安节

\(\mathrm{d}\)

是的

mmHg

毫米汞柱

\(\mathrm{133.32239\,Pa}\)

是的

mol

鼹鼠

\(\mathrm{mol}\)

是的

mp

质子质量

\(\mathrm{1.6726219 \times 10^{-27}\,kg}\)

是的

Msun

太阳质量

\(\mathrm{M_{\odot}}\)

solMass

是的

mu0

磁常数

\(\mathrm{1.2566371 \times 10^{-6}\,\frac{N}{A^{2}}}\)

µ0

是的

muB

玻尔磁子

\(\mathrm{9.2740101 \times 10^{-24}\,\frac{J}{T}}\)

是的

N

牛顿

\(\mathrm{N}\)

是的

Ohm

欧姆

\(\mathrm{\Omega}\)

是的

Pa

帕斯卡

\(\mathrm{Pa}\)

是的

pc

帕秒

\(\mathrm{pc}\)

是的

ph

光子

\(\mathrm{ph}\)

是的

pi

π

\(\mathrm{3.1415927}\)

是的

pix

象素

\(\mathrm{pix}\)

是的

ppm

百万分之几

\(\mathrm{1 \times 10^{-6}}\)

是的

R

气体常数

\(\mathrm{8.3144626\,\frac{J}{K\,mol}}\)

是的

rad

弧度

\(\mathrm{rad}\)

是的

Rgeo

地球赤道半径

\(\mathrm{6378100\,m}\)

是的

Rjup

木星赤道半径

\(\mathrm{71492000\,m}\)

是的

Rsun

太阳半径

\(\mathrm{R_{\odot}}\)

solRad

是的

Ry

里德堡

\(\mathrm{R_{\infty}}\)

是的

S

西门子

\(\mathrm{S}\)

是的

s

第二

\(\mathrm{s}\)

sec

是的

sr

甾体

\(\mathrm{sr}\)

是的

Sun

太阳能装置

\(\mathrm{Sun}\)

是的

T

特斯拉

\(\mathrm{T}\)

是的

t

公吨

\(\mathrm{1000\,kg}\)

是的

u

原子质量

\(\mathrm{1.6605391 \times 10^{-27}\,kg}\)

是的

V

伏特

\(\mathrm{V}\)

是的

W

瓦特

\(\mathrm{W}\)

是的

Wb

韦伯

\(\mathrm{Wb}\)

是的

yr

\(\mathrm{a}\)

是的

µas

微秒弧

\(\mathrm{\mu arcsec}\)

功能#

enable \()

启用CDS单元,使其显示在结果中 find_equivalent_unitscompose .

Asterpy.units.物理模块#

定义对应于不同单位的物理类型。

定义的物理类型#

物理类型

单位

同单位其他体型(S)

absement

\(\mathrm{m\,s}\)

absity

\(\mathrm{s^{2}\,m}\)

acceleration

\(\mathrm{\frac{m}{s^{2}}}\)

action

\(\mathrm{\frac{m^{2}\,kg}{s}}\)

角动量

代用品数量

\(\mathrm{mol}\)

angle

\(\mathrm{rad}\)

角加速度

\(\mathrm{\frac{rad}{s^{2}}}\)

角频率

\(\mathrm{\frac{rad}{s}}\)

角速度,角速度

角动量

\(\mathrm{\frac{m^{2}\,kg}{s}}\)

行动

角速度

\(\mathrm{\frac{rad}{s}}\)

角频率、角速度

角速度

\(\mathrm{\frac{rad}{s}}\)

角频率、角速度

area

\(\mathrm{m^{2}}\)

bandwidth

\(\mathrm{\frac{bit}{s}}\)

催化活性

\(\mathrm{\frac{mol}{s}}\)

化学势

\(\mathrm{\frac{J}{mol}}\)

列密度

\(\mathrm{\frac{1}{m^{2}}}\)

compressibility

\(\mathrm{\frac{1}{Pa}}\)

crackle

\(\mathrm{\frac{m}{s^{5}}}\)

数据量

\(\mathrm{bit}\)

diffusivity

\(\mathrm{\frac{m^{2}}{s}}\)

运动粘度

dimensionless

\(\mathrm{}\)

动力粘度

\(\mathrm{\frac{g}{m\,s}}\)

电容量

\(\mathrm{F}\)

电费

\(\mathrm{C}\)

电费(动车组)

\(\mathrm{abC}\)

电费(ESU)

\(\mathrm{Fr}\)

电荷密度

\(\mathrm{\frac{C}{m^{3}}}\)

电导

\(\mathrm{S}\)

导电性

\(\mathrm{\frac{S}{m}}\)

电流

\(\mathrm{A}\)

电流(动车组)

\(\mathrm{Bi}\)

电流(ESU)

\(\mathrm{statA}\)

电流密度

\(\mathrm{\frac{A}{m^{2}}}\)

电偶极矩

\(\mathrm{C\,m}\)

电场强度

\(\mathrm{\frac{V}{m}}\)

电磁场密度

\(\mathrm{\frac{C}{m^{2}}}\)

极化密度、表面电荷密度

电阻抗

\(\mathrm{\Omega}\)

电抗、电阻

电动汽车

\(\mathrm{\frac{m^{2}}{V\,s}}\)

电势

\(\mathrm{V}\)

电反应

\(\mathrm{\Omega}\)

电阻抗,电阻

电阻

\(\mathrm{\Omega}\)

电阻抗、电抗

电阻率

\(\mathrm{\Omega\,m}\)

电磁场强度

\(\mathrm{\frac{H}{m}}\)

透气性

电子密度

\(\mathrm{\frac{e^{-}}{m^{3}}}\)

电子通量

\(\mathrm{\frac{e^{-}}{s\,m^{2}}}\)

energy

\(\mathrm{J}\)

扭矩,功

能量密度

\(\mathrm{Pa}\)

压力,压力

energy flux

\(\mathrm{\frac{J}{s\,m^{2}}}\)

辐照度

entropy

\(\mathrm{\frac{J}{K}}\)

热容

force

\(\mathrm{N}\)

frequency

\(\mathrm{Hz}\)

频率漂移

\(\mathrm{\frac{1}{s^{2}}}\)

热容

\(\mathrm{\frac{J}{K}}\)

熵值

illuminance

\(\mathrm{lx}\)

发光发射度

impulse

\(\mathrm{\frac{kg\,m}{s}}\)

动量

inductance

\(\mathrm{H}\)

irradiance

\(\mathrm{\frac{J}{s\,m^{2}}}\)

能流

jerk

\(\mathrm{\frac{m}{s^{3}}}\)

摇晃

jolt

\(\mathrm{\frac{m}{s^{3}}}\)

混蛋

jounce

\(\mathrm{\frac{m}{s^{4}}}\)

捕捉

运动粘度

\(\mathrm{\frac{m^{2}}{s}}\)

扩散系数

length

\(\mathrm{m}\)

线性密度

\(\mathrm{\frac{kg}{m}}\)

luminance

\(\mathrm{\frac{cd}{m^{2}}}\)

发光效率

\(\mathrm{\frac{lm}{W}}\)

发光

\(\mathrm{lx}\)

照度

光通量

\(\mathrm{lm}\)

发光强度

\(\mathrm{cd}\)

磁场强度

\(\mathrm{\frac{A}{m}}\)

磁通

\(\mathrm{Wb}\)

磁通密度

\(\mathrm{T}\)

磁矩

\(\mathrm{m^{2}\,A}\)

磁阻

\(\mathrm{\frac{1}{H}}\)

mass

\(\mathrm{g}\)

质量衰减系数

\(\mathrm{\frac{m^{2}}{kg}}\)

不透明度

质量密度

\(\mathrm{\frac{kg}{m^{3}}}\)

质量流量

\(\mathrm{\frac{kg}{s\,m^{2}}}\)

动量密度

molality

\(\mathrm{\frac{mol}{kg}}\)

摩尔浓度

\(\mathrm{\frac{mol}{m^{3}}}\)

摩尔电导率

\(\mathrm{\frac{m^{2}\,S}{mol}}\)

摩尔热容

\(\mathrm{\frac{J}{K\,mol}}\)

摩尔体积

\(\mathrm{\frac{m^{3}}{mol}}\)

转动惯量

\(\mathrm{m^{2}\,kg}\)

momentum

\(\mathrm{\frac{kg\,m}{s}}\)

冲动

动量密度

\(\mathrm{\frac{kg}{s\,m^{2}}}\)

质量通量

数字密度

\(\mathrm{\frac{1}{m^{3}}}\)

opacity

\(\mathrm{\frac{m^{2}}{kg}}\)

质量衰减系数

粒子通量

\(\mathrm{\frac{1}{s\,m^{2}}}\)

permeability

\(\mathrm{\frac{H}{m}}\)

电磁场强度

permittivity

\(\mathrm{\frac{F}{m}}\)

光子流量

\(\mathrm{R}\)

光子通量密度

\(\mathrm{\frac{ph}{Hz\,s\,cm^{2}}}\)

光子通量密度波

\(\mathrm{\frac{ph}{\mathring{A}\,s\,cm^{2}}}\)

车牌秤

\(\mathrm{\frac{rad}{m}}\)

偏振密度

\(\mathrm{\frac{C}{m^{2}}}\)

电通量密度、表面电荷密度

pop

\(\mathrm{\frac{m}{s^{6}}}\)

突袭

pounce

\(\mathrm{\frac{m}{s^{6}}}\)

流行音乐

power

\(\mathrm{W}\)

辐射通量

功率密度

\(\mathrm{\frac{J}{s\,m^{3}}}\)

光谱通量密度波

pressure

\(\mathrm{Pa}\)

能量密度、压力

radiance

\(\mathrm{\frac{W}{sr\,m^{2}}}\)

辐射通量

\(\mathrm{W}\)

电源

辐射强度

\(\mathrm{\frac{W}{sr}}\)

反应率

\(\mathrm{\frac{mol}{s\,m^{3}}}\)

snap

\(\mathrm{\frac{m}{s^{4}}}\)

颠簸

立体角度

\(\mathrm{sr}\)

比能量

\(\mathrm{\frac{J}{kg}}\)

比熵

\(\mathrm{\frac{J}{K\,kg}}\)

比热容

比热容

\(\mathrm{\frac{J}{K\,kg}}\)

比熵

特定卷

\(\mathrm{\frac{m^{3}}{kg}}\)

光谱通量密度

\(\mathrm{Jy}\)

光谱通量密度波

\(\mathrm{\frac{J}{s\,m^{3}}}\)

功率密度

speed

\(\mathrm{\frac{m}{s}}\)

速度

stress

\(\mathrm{Pa}\)

能量密度、压力

表面电荷密度

\(\mathrm{\frac{C}{m^{2}}}\)

电通量密度、极化密度

表面质量密度

\(\mathrm{\frac{kg}{m^{2}}}\)

表面张力

\(\mathrm{\frac{m^{2}\,W}{Hz}}\)

temperature

\(\mathrm{K}\)

温度梯度

\(\mathrm{\frac{K}{m}}\)

热导

\(\mathrm{\frac{W}{K}}\)

导热系数

\(\mathrm{\frac{W}{K\,m}}\)

热阻

\(\mathrm{\frac{K}{W}}\)

耐热性

\(\mathrm{\frac{K\,m}{W}}\)

time

\(\mathrm{s}\)

torque

\(\mathrm{J}\)

能量,工作

velocity

\(\mathrm{\frac{m}{s}}\)

速度

volume

\(\mathrm{m^{3}}\)

体积流量

\(\mathrm{\frac{m^{3}}{s}}\)

容积率

\(\mathrm{\frac{1}{s\,m^{3}}}\)

wavenumber

\(\mathrm{\frac{1}{m}}\)

work

\(\mathrm{J}\)

能量、扭矩

yank

\(\mathrm{\frac{N}{s}}\)

功能#

def_physical_type(unit, name)

添加设备和相应物理类型之间的映射。

get_physical_type \(OBJ)

返回与一个单元(或另一个物理类型表示)对应的物理类型。

Classes#

PhysicalType(unit, physical_types)

表示在尺寸上与一组单位兼容的物理类型。

类继承图#

Inheritance diagram of astropy.units.physical.PhysicalType

astropy.units.等效模块#

一组标准的天文等价物。

功能#

parallax \()

返回处理视差角度和距离之间转换的等效对列表。

spectral \()

返回处理光谱波长、波数、频率和能量等效的等效对的列表。

spectral_density(wav[, factor])

返回处理与波长和频率有关的光谱密度的等效对列表。

doppler_radio \(休息)

返回速率的无线电约定的等效对。

doppler_optical \(休息)

返回速度光学约定的等效对。

doppler_relativistic \(休息)

返回速度的相对论性约定的等价对。

doppler_redshift \()

返回多普勒红移(无单位)和径向速度之间的等值。

mass_energy \()

返回处理质量和能量之间转换的等价对列表。

brightness_temperature(frequency[, beam_area])

定义Jy/sr和“亮度温度”之间的转换, \(T_B\) ,在凯尔文。

thermodynamic_temperature(frequency[, T_cmb])

定义了Jy/sr和“热力学温度”之间的转换, \(T_{{CMB}}\) ,在凯尔文。

beam_angular_area(beam_area)

beam 单位,通常用来表示射电望远镜分辨率元素的面积和天空中的面积。

dimensionless_angles \()

允许角度等于无量纲(1 rad=1 m/m=1)。

logarithmic \()

允许将对数单位转换为无因次分数。

temperature \()

在这里转换开尔文、摄氏度、兰金和华氏度,因为单位和合成单位不能正确地进行加减运算。

temperature_energy \()

在开尔文和keV(eV)之间换算成相等的量。

molar_mass_amu \()

返回amu和摩尔质量之间的等效值。

pixel_scale \(像素比例)

在像素距离之间转换(单位为 pix )以及其他单位 pixscale .

plate_scale \(平台刻度)

在长度(被解释为焦平面中的长度)和角度单位之间转换 platescale .

Classes#

Equivalency(equiv_list[, name, kwargs])

单位等价物的容器。

类继承图#

Inheritance diagram of astropy.units.equivalencies.Equivalency

Asterpy.units.unction.core模块#

功能单位和数量。

Classes#

FunctionUnitBase([physical_unit, function_unit])

函数单元的抽象基类。

FunctionQuantity(value[, unit, dtype, copy, ...])

用单位表示一个数的(标度)函数。

类继承图#

Inheritance diagram of astropy.units.function.core.FunctionUnitBase, astropy.units.function.core.FunctionQuantity

astropy.units.function.函数.对数模#

Classes#

LogUnit([physical_unit, function_unit])

包含一个物理单位的对数单位。

MagUnit([physical_unit, function_unit])

以量级表示的对数物理单位。

DexUnit([physical_unit, function_unit])

以量级表示的对数物理单位。

DecibelUnit([physical_unit, function_unit])

以分贝表示的对数物理单位。

LogQuantity(value[, unit, dtype, copy, ...])

一个数与一个单位的(标度)对数的表示。

Magnitude(value[, unit, dtype, copy, order, ...])

Decibel(value[, unit, dtype, copy, order, ...])

Dex(value[, unit, dtype, copy, order, ...])

变量#

STmag 

ST震级:STmag=-21.1对应于1 erg/s/cm2/A

ABmag 

AB幅值:ABmag=-48.6对应于1 erg/s/cm2/Hz

M_bol 

绝对热辐射量值:M_bol=0对应于L_bol0=3.0128e+28 J/s

m_bol 

表观热辐射量值:m_bol=0对应于f_bol0=2.51802e-08 kg/s3

类继承图#

Inheritance diagram of astropy.units.function.logarithmic.LogUnit, astropy.units.function.logarithmic.MagUnit, astropy.units.function.logarithmic.DexUnit, astropy.units.function.logarithmic.DecibelUnit, astropy.units.function.logarithmic.LogQuantity, astropy.units.function.logarithmic.Magnitude, astropy.units.function.logarithmic.Decibel, astropy.units.function.logarithmic.Dex

astropy.units.已弃用模块#

此包定义了不推荐使用的单元。

这些单元在顶级中不可用 astropy.units 命名空间。要使用这些单位,必须导入 astropy.units.deprecated 模块:

>>> from astropy.units import deprecated
>>> q = 10. * deprecated.emu  

把他们包括在 compose 以及 find_equivalent_units DO::

>>> from astropy.units import deprecated
>>> deprecated.enable()  
可用单位#

单位

描述

代表

别名

SI前缀

emu

比奥:CGS(EMU)电流单位

\(\mathrm{Bi}\)

前缀 earthMass

地球质量前缀

\(\mathrm{5.9721679 \times 10^{24}\,kg}\)

M_earth, Mearth

只有

前缀 earthRad

地球半径前缀

\(\mathrm{6378100\,m}\)

R_earth, Rearth

只有

前缀 jupiterMass

木星质量前缀

\(\mathrm{1.8981246 \times 10^{27}\,kg}\)

M_jup, Mjup, M_jupiter, Mjupiter

只有

前缀 jupiterRad

木星半径前缀

\(\mathrm{71492000\,m}\)

R_jup, Rjup, R_jupiter, Rjupiter

只有

功能#

enable \()

启用不推荐使用的单位,以便它们出现在 find_equivalent_unitscompose .

astropy.units.需要模块#

此软件包定义了VOUnit标准要求的SI前缀单位,但这些单位在实践中很少使用,并且容易导致混淆(例如 msolMass 百万太阳质量)。它们在一个独立的模块中 astropy.units.deprecated 因为它们需要在默认情况下为 astropy.units 解析兼容的VOUnit字符串。因此,例如。, Unit('msolMass') 将只是工作,但要直接访问单元,请使用 astropy.units.required_by_vounit.msolMass 而不是无前缀单元可能使用的更典型的习惯用法, astropy.units.solMass .

可用单位#

单位

描述

代表

别名

SI前缀

前缀 solLum

日光亮度前缀

\(\mathrm{3.828 \times 10^{26}\,W}\)

L_sun, Lsun

只有

前缀 solMass

太阳质量前缀

\(\mathrm{1.9884099 \times 10^{30}\,kg}\)

M_sun, Msun

只有

前缀 solRad

太阳半径前缀

\(\mathrm{6.957 \times 10^{8}\,m}\)

R_sun, Rsun

只有