ApdbReconstructor#

class lsst.analysis.ap.ApdbReconstructor(butler, dataset_names=None, *, collections=None, where=None)#

Bases: object

Reconstruct APDB-shaped catalogs from DiaPipelineTask butler outputs.

Parameters#

butlerlsst.daf.butler.Butler

Butler initialized with the collections that hold the pipeline run.

dataset_namesdict [str, list [str]], optional

Override the default dataset types used for each table. Keys are "diaSource", "diaObject", "diaForcedSource"; each value is a list of dataset-type names that get concatenated and deduplicated. Defaults to DEFAULT_DATASET_NAMES, which includes the preloaded_* datasets so the reconstruction includes both “history” rows from preload and the new ones.

collectionslist [str], optional

Specify the butler collections to query if not using the default configured for the butler.

wherestr, optional

Butler where clause passed through to queryDatasets (e.g. "instrument='LSSTComCam' AND visit > 1000").

Attributes Summary

Methods Summary

finalize(diaSources, diaObjects, ...[, ...])

Dedup and (optionally) schema-coerce already-loaded catalogs.

reconstruct(*[, coerce_to_schema, history])

Load all per-quantum catalogs and return APDB-shaped DataFrames.

to_query(*[, coerce_to_schema, history])

Reconstruct and wrap the result as a DbQuery-compatible adapter so the in-memory frames can be passed to lightcurve, PlotDiaSourceLightcurveTask, and other tools that expect the DbQuery interface.

Attributes Documentation

DEFAULT_DATASET_NAMES = {'diaForcedSource': ['dia_forced_source_apdb', 'preloaded_dia_forced_source'], 'diaObject': ['dia_object_apdb', 'preloaded_dia_object'], 'diaSource': ['dia_source_apdb', 'preloaded_dia_source']}#

Methods Documentation

static finalize(diaSources, diaObjects, diaForcedSources, *, coerce_to_schema=True, history=False)#

Dedup and (optionally) schema-coerce already-loaded catalogs.

Parameters#

diaSources, diaObjects, diaForcedSourcespandas.DataFrame

Concatenated per-quantum catalogs.

coerce_to_schema, history : see reconstruct.

Returns#

result : ApdbReconstruction

reconstruct(*, coerce_to_schema=True, history=False)#

Load all per-quantum catalogs and return APDB-shaped DataFrames.

Parameters#

coerce_to_schemabool, optional

If True (default), coerce each output to the SDM apdb.yaml schema.

historybool, optional

If True, keep every diaObject row written across all quanta. If False (default), dedupe to the atest row per diaObjectId, mirroring the “current APDB state” view that DiaObjectLast would give.

Returns#

result : ApdbReconstruction

to_query(*, coerce_to_schema=True, history=False)#

Reconstruct and wrap the result as a DbQuery-compatible adapter so the in-memory frames can be passed to lightcurve, PlotDiaSourceLightcurveTask, and other tools that expect the DbQuery interface.

Returns#

query : InMemoryDbQuery