我正在尝试在两个具有星号(Tabla)的表和另一个具有望远镜视场的表之间进行坐标交叉匹配,并返回与恒星的坐标匹配的行。 星星必须位于视场的x&y(RA,DEC)加上差值(dx,dy,在我的情况下为df)的位置。
一切似乎都是正确的,直到使用交叉匹配的星的行创建列表交叉,但只包含它们的索引。因此,我使用print(crossmatch)来查看星星是否正确,以及它们是否正确,所以我的问题必须在附加部分中。
import matplotlib.pyplot as plt
import pandas as pd
import sys
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tabla = pd.read_csv('Tabla_Crossmatch_01.csv', header= 0)
RA = Tabla['_RAJ2000']
DEC = Tabla['_DEJ2000']
Name = Tabla['WD']
Campos = pd.read_csv('Fields.csv', header= 0)
RA_fields = Campos['RA:(decimal)']
DEC_fields = Campos['Dec:(decimal)']
Campo = Campos['Field']
f_view = 1.7
df = f_view/2
cross = []
cont = 1
for i,ii in zip (Tabla['_RAJ2000'],Tabla['_DEJ2000']):
for j,jj in zip (RA_fields,DEC_fields):
if j-df <= i <= j+df and jj-df <= ii <= jj+df:
crossmatch = Tabla.loc[(Tabla['_RAJ2000'] == i) & (Tabla['_DEJ2000'] == ii)]
cross.append(crossmatch)
print(crossmatch)
结果:
_RAJ2000 _DEJ2000 WD ... S/N SpClass Sp
35 119.51847 20.999396 WDJ075804.43+205957.86 ... 0.0 Unreliable Sp
[1 rows x 19 columns]
_RAJ2000 _DEJ2000 WD ... S/N SpClass Sp
62 155.27775 8.456804 WDJ102106.71+082724.97 ... 42.465915 DB Sp
[1 rows x 19 columns]
_RAJ2000 _DEJ2000 WD ... S/N SpClass Sp
63 155.27791 8.456894 WDJ102106.71+082724.97 ... 0.0 Unreliable Sp
[1 rows x 19 columns]
_RAJ2000 _DEJ2000 WD ... S/N SpClass Sp
82 175.41995 0.146517 WDJ114140.79+000847.49 ... 0.0 Unreliable Sp
[1 rows x 19 columns]
_RAJ2000 _DEJ2000 WD ... S/N SpClass Sp
87 179.54766 -0.046197 WDJ115811.43-000246.23 ... 0.0 Unreliable Sp
[1 rows x 19 columns]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~