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')#

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.

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.