table_xmatch

gammapy.catalog.table_xmatch(table1, table2, xmatch_criterion, return_indices=True)[source]

Cross-match rows from two tables with a cross-match criterion callback.

Note: This is a very flexible and simple way to find matching rows from two tables, but it can be very slow, e.g. if you create SkyCoord objects or index into them in the callback cross-match criterion function: https://github.com/astropy/astropy/issues/3323#issuecomment-71657245

Parameters:

table1, table2 : Table

Input tables

xmatch_criterion : callable

Callable that takes two Row objects as input and returns True / False when they match / don’t match.

return_indices : bool

If True this function returns a Table with match indices idx1 and idx2, if False it stacks the matches in a table using hstack.

Returns:

matches : Table

Match table (one match per row)