AssociationTask

class lsst.ap.association.AssociationTask(**kwargs)

Bases: lsst.pipe.base.Task

Associate DIAOSources into existing DIAObjects.

This task performs the association of detected DIASources in a visit with the previous DIAObjects detected over time. It also creates new DIAObjects out of DIASources that cannot be associated with previously detected DIAObjects.

Methods Summary

associate_sources(dia_objects, dia_sources) Associate the input DIASources with the catalog of DIAObjects.
match(dia_objects, dia_sources, score_struct) Match DIAsources to DIAObjects given a score and create new DIAObject Ids for new unassociated DIASources.
run(dia_sources, exposure) Load DIAObjects from the database, associate the sources, and persist the results into the L1 database.
score(dia_objects, dia_sources, max_dist) Compute a quality score for each dia_source/dia_object pair between this catalog of DIAObjects and the input DIASource catalog.
update_dia_objects(dia_objects, …) Update select dia_objects currently stored within the database or create new ones.

Methods Documentation

associate_sources(dia_objects, dia_sources)

Associate the input DIASources with the catalog of DIAObjects.

Parameters:
dia_objects : lsst.afw.table.SourceCatalog

Catalog of DIAObjects to attempt to associate the input DIASources into.

dia_sources : lsst.afw.table.SourceCatalog

DIASources to associate into the DIAObjectCollection.

Returns:
updated_ids : array-like of int

Ids of the DIAObjects that the DIASources associated to including the ids of newly created DIAObjects.

match(dia_objects, dia_sources, score_struct)

Match DIAsources to DIAObjects given a score and create new DIAObject Ids for new unassociated DIASources.

Parameters:
dia_objects : lsst.afw.table.SourceCatalog

A SourceCatalog of DIAObjects to associate to DIASources.

dia_sources : lsst.afw.table.SourceCatalog

A contiguous catalog of dia_sources for which the set of scores has been computed on with DIAObjectCollection.score.

score_struct : lsst.pipe.base.Struct

Results struct with components:

  • scores: array of floats of match quality
    updated DIAObjects (array-like of float).
  • obj_ids: array of floats of match quality
    updated DIAObjects (array-like of int).
  • obj_idxs: indexes of the matched DIAObjects in the catalog.
    (array-like of int)

Default values for these arrays are INF, -1 and -1 respectively for unassociated sources.

Returns:
result : lsst.pipeBase.Struct

Results struct with components:

  • updated_and_new_dia_object_ids : ids of new and updated dia_objects as the result of association. (list of int).
  • n_updated_dia_objects : Number of previously know dia_objects with newly associated DIASources. (int).
  • n_new_dia_objects : Number of newly created DIAObjects from unassociated DIASources (int).
  • n_unupdated_dia_objects : Number of previous DIAObjects that were not associated to a new DIASource (int).
run(dia_sources, exposure)

Load DIAObjects from the database, associate the sources, and persist the results into the L1 database.

Parameters:
dia_sources : lsst.afw.table.SourceCatalog

DIASources to be associated with existing DIAObjects.

exposure : lsst.afw.image

Input exposure representing the region of the sky the dia_sources were detected on. Should contain both the solved WCS and a bounding box of the ccd.

score(dia_objects, dia_sources, max_dist)

Compute a quality score for each dia_source/dia_object pair between this catalog of DIAObjects and the input DIASource catalog.

max_dist sets maximum separation in arcseconds to consider a dia_source a possible match to a dia_object. If the pair is beyond this distance no score is computed.

Parameters:
dia_objects : lsst.afw.table.SourceCatalog

A contiguous catalog of DIAObjects to score against dia_sources.

dia_sources : lsst.afw.table.SourceCatalog

A contiguous catalog of dia_sources to “score” based on distance and (in the future) other metrics.

max_dist : lsst.afw.geom.Angle

Maximum allowed distance to compute a score for a given DIAObject DIASource pair.

Returns:
result : lsst.pipe.base.Struct

Results struct with components:

  • scores: array of floats of match quality updated DIAObjects
    (array-like of float).
  • obj_idxs: indexes of the matched DIAObjects in the catalog.
    (array-like of int)
  • obj_ids: array of floats of match quality updated DIAObjects
    (array-like of int).

Default values for these arrays are INF, -1, and -1 respectively for unassociated sources.

update_dia_objects(dia_objects, updated_obj_ids, exposure)

Update select dia_objects currently stored within the database or create new ones.

Parameters:
dia_objects : lsst.afw.table.SourceCatalog

Pre-existing/loaded DIAObjects to copy values that are not updated from.

updated_obj_ids : array-like of int

Ids of the dia_objects that should be updated.

exposure : lsst.afw.image.Exposure

Input exposure representing the region of the sky the dia_sources were detected on. Should contain both the solved WCS and a bounding box of the ccd.