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_newlsst.daf.butler.Butler

Butlers whose default collections hold the reference and new runs.

datasetstr, optional

Visit-level diaSource table; diaSourceTable in DRP.

detector_datasetstr, optional

Detector-level diaSource table read for a visit that has no dataset table, as in a run that skipped consolidateDiaSourceTable.

visitscollections.abc.Iterable [int], optional

Visits to compare; all visits if not given.

radiusastropy.units.Quantity, optional

Largest separation of a matched pair.

explain_unmatchedbool, 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 reason is None.

upstream_datasetsdict [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_datasetstr, optional

Catalog of all detections, whose IDs the removed detections keep. A source found only there has reason removed_later; one absent from it has not_detected.

Returns#

comparisonDiaSourceComparison

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_catalogs with one_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_elsewhere

The 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_reliability is its score), rejected (by filterDiaSource) or long_trail.

removed_later

The other run detected the source but it is in none of those catalogs.

not_detected

The other run’s detection catalog has no source there.

no_data

The other run has none of these catalogs for the detector, nor any sources on it.

unknown

The other run lacks the detection catalog but wrote others.