CDS#

class astropy.units.format.CDS(*args, **kwargs)[源代码]#

基类:Base

支持 Centre de Données astronomiques de Strasbourg Standards for Astronomical Catalogues 2.0 格式,并且 complete set of supported units 。VOTABLE直到1.2版都使用此格式。

属性摘要

name 

方法总结

format_exponential_notation(val[, format_spec])

将值格式化为指数表示法。

parse(s[, debug])

将字符串转换为单位对象。

to_string(unit[, fraction])

将单位转换为其字符串表示形式。

属性文档

name = 'cds'#

方法文件

classmethod format_exponential_notation(val, format_spec='.8g')[源代码]#

将值格式化为指数表示法。

参数:
val : number

要格式化的值

format_spec : str ,可选Python:字符串,可选

用于拆分尾数和指数的格式

返回:
str

此类格式的指数表示法中的值。

classmethod parse(s, debug=False)[源代码]#

将字符串转换为单位对象。

classmethod to_string(unit, fraction=False)[源代码]#

将单位转换为其字符串表示形式。

实施 to_string

参数:
unitUnitBase单位

要转换的单位。

fraction{False|True|'inline'|'multiline'}, optional

选项如下:

  • False :原样具有负功率的显示单元底座(例如, km s-1 );

  • ‘inline’或 True :使用单行分数(例如, km / s );

  • “MULTINE”:使用多行分数(可用于 latexconsoleunicode 仅格式;例如, $\mathrm{\frac{km}{s}}$ )。

加薪:
ValueError

如果 fraction 不被识别。