classify_association_clusters#
- lsst.analysis.ap.classify_association_clusters(sources1, sources2, match_radius=0.5)#
Enumerate and classify every association-disagreement cluster between two APDBs that share input diaSources.
Builds the bipartite graph whose edges are
(diaSource -> its run-1 diaObject, diaSource -> its run-2 diaObject)over all diaSources the two runs have in common, runs union-find over the diaObjectIds to extract every connected component, and labels each cluster:matched– one run-1 obj <-> one run-2 obj.split– one run-1 obj split into multiple run-2 objs.merged– multiple run-1 objs merged into one run-2 obj.tangled– M run-1 objs <-> N run-2 objs, both > 1.
diaSourceIds are not stable across runs: they carry a per-catalog counter assigned in detection order, so any change to detection or measurement renumbers them. The common diaSources are therefore identified by position (nearest neighbor within
match_radius, inside a single (visit, detector)) rather than by id. Sources with no counterpart in the other run are skipped.Parameters#
- sources1, sources2
pandas.DataFrame Full diaSources catalogs from runs 1 and 2 (e.g. from
query.load_sources()). Each must containdiaSourceId,diaObjectId,ra,dec,visit, anddetectorcolumns.- match_radius
float, optional Maximum separation in arcsec for two diaSources to be considered the same detection in both runs.
Returns#
- clusters
pandas.DataFrame - One row per cluster, with columns:
kind: matched / split / merged / tangled.n_obj1,n_obj2: distinct diaObject counts per run.n_sources: matched diaSource pairs in the cluster.obj1_ids,obj2_ids: tuples of diaObjectIds.ra,dec: mean sky position of the cluster’s diaSources (degrees).