22__all__ = [
"ConsolidateSsTablesConfig",
"ConsolidateSsTablesTask",
"ConsolidateSsTablesConnections"]
24import astropy.table
as tb
28import lsst.pipe.base
as pipeBase
29import lsst.pipe.base.connectionTypes
as cT
30from lsst.obs.base.utils
import TableVStack
31from lsst.utils.timer
import timeMethod
33warnings.filterwarnings(
'ignore')
37 dimensions=(
"skymap",),
38 defaultTemplates={
"coaddName":
"goodSeeing",
40 inputCatalogs = cT.Input(
41 doc=
"associated ssSources from all tract-patches.",
42 name=
"{fakesType}{coaddName}Diff_assocSsSrcTable",
43 storageClass=
"ArrowAstropy",
44 dimensions=(
"tract",
"patch"),
48 ssSourceTable = cT.Output(
50 name=
"{fakesType}{coaddName}Diff_ssSrcTable",
51 storageClass=
"ArrowAstropy",
54 ssObjectTable = cT.Output(
56 name=
"{fakesType}{coaddName}Diff_ssObjTable",
57 storageClass=
"ArrowAstropy",
62class ConsolidateSsTablesConfig(pipeBase.PipelineTaskConfig,
63 pipelineConnections=ConsolidateSsTablesConnections):
65 """Config for ConsolidateSsTablesTask"""
68class ConsolidateSsTablesTask(pipeBase.PipelineTask):
69 """ Consolidate per-patch ssSource tables into a single table.
71 TODO (DM-49451): Fit per-object parameters
72 TODO (DM-49453): Generate MPCORB table.
75 ConfigClass = ConsolidateSsTablesConfig
76 _DefaultName =
"consolidateSsTables"
79 def run(self, inputCatalogs):
80 """Concatenate per-patch ssSource tables.
81 Generate ssObject table.
85 inputCatalogs `list` of `lsst.daf.butler.DeferredDatasetHandle`:
86 All per-patch ssSource Tables
90 output : `lsst.pipe.base.Struct`
91 Results struct with attributes:
95 (`astropy.table.Table`)
98 (`astropy.table.Table`).
100 self.log.info(
"Concatenating %s per-patch ssSource Tables",
102 ssSourceTable = TableVStack.vstack_handles(inputCatalogs)
103 ssObjectTable = tb.Table()
104 ssObjectTable[
'ssObjectId'], ssObjectTable[
'numObs'] = np.unique(ssSourceTable[
'ssObjectId'],
106 ssObjectTable[
'discoverySubmissionDate'] = np.nan
108 return pipeBase.Struct(
109 ssSourceTable=ssSourceTable,
110 ssObjectTable=ssObjectTable,