I have 2 astronomical tables, from a fits file and a csv file, that look something like this
ra, dec, val_a, val_b, ... 11.11, 22.22, 8, 9, ... 10.10, 20.20, 7, 6, ... ...
ra, dec, val_x, val_y, ... 44.4, 55.55, 8, 9, ... 15.67, 23.45, 7, 6, ... ...
One table contains 15M galaxies and the other 80k. I would like to merge/cross-match the objects in these 2 tables with astropy, as long as corresponding objects have a separation smaller than a threshold distance in degrees. I know how to load the tables into astropy tables. And I know of the existence of
skycoord and the
join_skycoord function. But I am not able to apply them, because I don't find anywhere explained how when reading a table I specify
skycoord columns or how I can later change the type of the columns to
skycoord or how I can merge
skycoord columns into my tables.
Can someone provide me with code that can merge the 2 tables based on the sky coordinates? I would be also thankful for alternatives, that don't utilize astropy. Tnx