match_catalogs#

lsst.analysis.ap.match_catalogs(srcs1, srcs2, radius=<Quantity 0.5 arcsec>, on=('visit', 'detector'), ra_col='ra', dec_col='dec', id_col='diaSourceId', one_to_one=False)#

Spatially cross-match two DiaSource-like DataFrames.

Sources are first partitioned by the columns in on (e.g. matched only within the same (visit, detector)), then matched via nearest-neighbor on the sphere.

Parameters#

srcs1, srcs2pandas.DataFrame

Source tables. Each must contain ra_col, dec_col, id_col, and every column listed in on.

radiusastropy.units.Quantity or float

Maximum separation for a pair to count as matched. A bare float is interpreted as arcseconds.

ontuple [str]

Columns to group on before matching. Pass an empty tuple to match the full catalog with no grouping.

ra_col, dec_colstr

Column names for sky coordinates, in degrees.

id_colstr

Column name for the source id in both catalogs.

one_to_onebool, optional

If True, each source is in at most one pair: pairs within radius are taken in order of increasing separation, skipping any whose sources are already paired. If False, each source in srcs1 is paired with its nearest neighbor in srcs2, so several may share one partner.

Returns#

matchedpandas.DataFrame

Rows from srcs1 that found a partner in srcs2 within radius. Two columns are added: <id_col>_2 with the partner’s id, and xmatch_dist_arcsec with the on-sky separation in arcsec.

unique1pandas.DataFrame

Rows from srcs1 with no partner.

unique2pandas.DataFrame

Rows from srcs2 not pointed at by any matched pair.