join_distance#
- astropy.table.join_distance(distance, kdtree_args=None, query_args=None)[源代码]#
使用距离匹配连接表列的助手函数。
此函数用于
table.join()
允许通过计算点之间的距离并接受以下值来执行与键列匹配的表联接distance
. 这种数值“模糊”匹配可以应用于一维或二维列,后者的距离是向量距离。距离交叉匹配是用
scipy.spatial.cKDTree
. 如果需要,可以通过提供dict
值为kdtree_args
或query_args
.- 参数:
- 返回:
- join_func : functionPYTHON:函数
函数,它接受(skycoord1,skycoord2)并返回成对匹配的唯一标识符的元组(ids1,ids2)。
实例
>>> from astropy.table import Table, join_distance >>> from astropy import table
>>> c1 = [0, 1, 1.1, 2] >>> c2 = [0.5, 1.05, 2.1]
>>> t1 = Table([c1], names=['col']) >>> t2 = Table([c2], names=['col']) >>> t12 = table.join(t1, t2, join_type='outer', join_funcs={'col': join_distance(0.2)}) >>> print(t12) col_id col_1 col_2 ------ ----- ----- 1 1.0 1.05 1 1.1 1.05 2 2.0 2.1 3 0.0 -- 4 -- 0.5