represent_mixins_as_columns#
- astropy.table.represent_mixins_as_columns(tbl, exclude_classes=())[源代码]#
表示输入表
tbl仅使用Column或MaskedColumn物体。此函数表示任何mixin列,如
Time在里面tbl一个或多个平原~astropy.table.Column对象并返回一个新表。单个mixin列可以根据需要拆分为多个列组件,以完全表示该列。这包括递归拆分的可能性,如下例所示。新列名的格式如下<column_name>.<component>,例如sc.ra对于一个SkyCoord列名为sc.除了拆分列,此函数还更新表
meta包含名为__serialized_columns__它提供了从拆分列构造原始mixin列所需的附加信息。在将表写入ECSV、FITS、HDF5格式时,astropy I/O使用此函数。
请注意,如果表不包含任何mixin列,则返回原始表时不更新
meta.- 参数:
- 返回:
- tbl :
Table表 具有更新列的新表,或原始输入
tbl
- tbl :
实例
>>> from astropy.table import Table, represent_mixins_as_columns >>> from astropy.time import Time >>> from astropy.coordinates import SkyCoord
>>> x = [100.0, 200.0] >>> obstime = Time([1999.0, 2000.0], format='jyear') >>> sc = SkyCoord([1, 2], [3, 4], unit='deg', obstime=obstime) >>> tbl = Table([sc, x], names=['sc', 'x']) >>> represent_mixins_as_columns(tbl) <Table length=2> sc.ra sc.dec sc.obstime.jd1 sc.obstime.jd2 x deg deg float64 float64 float64 float64 float64 ------- ------- -------------- -------------- ------- 1.0 3.0 2451180.0 -0.25 100.0 2.0 4.0 2451545.0 0.0 200.0