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, 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.
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