xmatch_fields

utilipy.data_utils.xmatch_fields(catalog: numpy.recarray, *others: numpy.recarray, fields: List[str]) → Tuple[List[Any], Dict[str, Sequence]][source]

Cross-match catalogs’ data field(s) against a source catalog.

This function is for discrete-valued data, such as tags. For coordinates, see indices_xmatch_coords.

This match is done on all the fields simultaneously, so in terms or a 2D array, two rows are considered a match only if all the values in the columns fields match.

Parameters
catalogTable or recarray

The source catalog against which the others catalogs are matched. fields for which there are no matches are also filtered.

*othersTable or recarray

match these against catalog

fieldslist

List of fields on which to match. ex, [“color”, “location”] where both catalog and other have those columns, hopefully with some matching values.

Returns
idxslist of ndarrays

each element of list is the x-match indices into the ith catalog, starting with catalog. So the i=0 index list is for catalog and the i=1 index list is the x-match indices for the first table in others,

Notes

Todo

try more axes tricks to avoid loops.