compare_dia_sources#
- lsst.analysis.ap.compare_dia_sources(butler_ref, butler_new, *, dataset='dia_source_visit', detector_dataset='dia_source_detector', visits=None, radius=<Quantity 0.5 arcsec>, explain_unmatched=True, upstream_datasets={'long_trail': 'long_trailed_source_detector', 'low_reliability': 'dia_source_low_reliability', 'rejected': 'rejected_dia_source'}, detection_dataset='dia_source_unfiltered')#
Match the diaSources of two runs and explain the differences.
Parameters#
- butler_ref, butler_new
lsst.daf.butler.Butler Butlers whose default collections hold the reference and new runs.
- dataset
str, optional Visit-level diaSource table;
diaSourceTablein DRP.- detector_dataset
str, optional Detector-level diaSource table read for a visit that has no
datasettable, as in a run that skippedconsolidateDiaSourceTable.- visits
collections.abc.Iterable[int], optional Visits to compare; all visits if not given.
- radius
astropy.units.Quantity, optional Largest separation of a matched pair.
- explain_unmatched
bool, optional Look for each unmatched source in the other run’s earlier catalogs to find why it has no partner. This reads those catalogs for every detector with an unmatched source. If False, every
reasonisNone.- upstream_datasets
dict[str,str], optional Catalogs of removed detections, keyed by the reason recorded when a source is found in one. The first is searched by position, so list the most common reason first; the rest are searched by the ID of the source’s detection in
detection_dataset.- detection_dataset
str, optional Catalog of all detections, whose IDs the removed detections keep. A source found only there has reason
removed_later; one absent from it hasnot_detected.
Returns#
- comparison
DiaSourceComparison The matched pairs, unmatched sources and summaries.
Raises#
- LookupError
Raised if neither run has any diaSources.
Notes#
Sources are paired one to one within each visit, closest pairs first (
match_catalogswithone_to_one=True), so a source that lands on a neighboring detector in the other run still matches.The reason for an unmatched source is the first that applies:
matched_elsewhereThe other run has a source within
radius, which was paired with a closer source (a split or merged detection).- a key of
upstream_datasets The other run detected the source and removed it; by default
low_reliability(other_reliabilityis its score),rejected(byfilterDiaSource) orlong_trail.removed_laterThe other run detected the source but it is in none of those catalogs.
not_detectedThe other run’s detection catalog has no source there.
no_dataThe other run has none of these catalogs for the detector, nor any sources on it.
unknownThe other run lacks the detection catalog but wrote others.
- butler_ref, butler_new