match_to_truth#
- lsst.analysis.ap.match_to_truth(srcs, truth, radius=<Quantity 0.5 arcsec>, src_ra='ra', src_dec='dec', src_id='diaSourceId', truth_ra='ra', truth_dec='dec', truth_id='injection_id')#
Match a detected catalog against a truth/injection catalog.
Performs the match in both directions to compute purity (fraction of detections that correspond to a real injected source) and completeness (fraction of injected sources recovered).
Parameters#
- srcs
pandas.DataFrame Detected sources.
- truth
pandas.DataFrame Truth catalog, e.g. an injection catalog.
- radius
astropy.units.Quantityorfloat Maximum separation for a match.
- src_ra, src_dec, src_id
str Column names in
srcs.- truth_ra, truth_dec, truth_id
str Column names in
truth.
Returns#
- out
dict With keys:
"srcs": a copy ofsrcswith three columns appended:"is_real"(bool),"truth_dist_arcsec"(float), andf"{truth_id}_match"(matched truth id, NA if no match)."truth": a copy oftruthwith three columns appended:"detected","detection_dist_arcsec", andf"{src_id}_match"."purity": float, fraction ofsrcsrows withis_real."completeness": float, fraction oftruthrows withdetected.
- srcs