AstroPy:如何从TableList删除表

问题描述 投票:0回答:1

我正在使用AstroPy的Vizier Queries软件包通过Vizier目录搜索天文资源。运行代码后,我将获得一个TableList,其中包括目录列表。

opticalViz = Vizier(columns=['_RAJ2000', '_DEJ2000','B-V', 'Vmag', 'Bmag'], 
                   keywords = ['optical'])
catalog_list = opticalViz.query_region(coord.SkyCoord('00 57 27.09 -73 25 14.4', 
                                                      unit=(u.hourangle, u.deg)), 
                                                     radius = Angle((0,0,6.3), unit = u.deg) )

print(catalog_list)

输出]

TableList with 18 tables:
    '0:I/221/smc' with 3 column(s) and 1 row(s) 
    '1:I/252/out' with 4 column(s) and 1 row(s) 
    '2:I/271/out' with 3 column(s) and 1 row(s) 
    '3:I/284/out' with 3 column(s) and 1 row(s) 
    '4:I/297/out' with 4 column(s) and 1 row(s) 
    '5:I/305/out' with 4 column(s) and 1 row(s) 
    '6:I/317/sample' with 3 column(s) and 1 row(s) 
    '7:I/319/xpm' with 4 column(s) and 1 row(s) 
    '8:I/320/spm4' with 4 column(s) and 1 row(s) 
    '9:I/322A/out' with 4 column(s) and 1 row(s) 
    '10:I/337/gaia' with 3 column(s) and 2 row(s) 
    '11:I/339/hsoy' with 3 column(s) and 1 row(s) 
    '12:I/345/gaia2' with 3 column(s) and 3 row(s) 
    '13:II/236/smc' with 4 column(s) and 1 row(s) 
    '14:II/336/apass9' with 5 column(s) and 1 row(s) 
    '15:IV/38/tic' with 4 column(s) and 3 row(s) 
    '16:J/A+A/586/A81/table5' with 5 column(s) and 1 row(s) 
    '17:J/AJ/123/855/table1' with 4 column(s) and 3 row(s) 

这非常类似于字典,其键是目录名,值是表。我希望能够通过键名删除特定的目录/表。但是,当我尝试使用del catalog_list['I/345/gaia2']时,出现错误,指出列表索引必须是数字。

任何人都可以了解TableList的确切含义以及如何从中删除特定元素吗?

我正在使用AstroPy的Vizier Queries软件包通过Vizier目录搜索天文资源。运行代码后,我将获得一个TableList,其中包括目录列表。 OpticalViz = ...

python list dictionary astropy
1个回答
0
投票

TableLists是OrderedDict的包装器。它们在astroquery中用于最小化表示从服务返回的表。

© www.soinside.com 2019 - 2024. All rights reserved.