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, srcs2
pandas.DataFrame Source tables. Each must contain
ra_col,dec_col,id_col, and every column listed inon.- radius
astropy.units.Quantityorfloat Maximum separation for a pair to count as matched. A bare float is interpreted as arcseconds.
- on
tuple[str] Columns to group on before matching. Pass an empty tuple to match the full catalog with no grouping.
- ra_col, dec_col
str Column names for sky coordinates, in degrees.
- id_col
str Column name for the source id in both catalogs.
- one_to_one
bool, optional If True, each source is in at most one pair: pairs within
radiusare taken in order of increasing separation, skipping any whose sources are already paired. If False, each source insrcs1is paired with its nearest neighbor insrcs2, so several may share one partner.
Returns#
- matched
pandas.DataFrame Rows from
srcs1that found a partner insrcs2withinradius. Two columns are added:<id_col>_2with the partner’s id, andxmatch_dist_arcsecwith the on-sky separation in arcsec.- unique1
pandas.DataFrame Rows from
srcs1with no partner.- unique2
pandas.DataFrame Rows from
srcs2not pointed at by any matched pair.
- srcs1, srcs2