22from __future__
import annotations
24__all__ = (
"RewriteLazyCoaddConnections",
"RewriteLazyCoaddTask",
"RewriteLazyCoaddConfig")
26from typing
import ClassVar
28import lsst.pipe.base.connectionTypes
as cT
30from lsst.daf.butler
import DataCoordinate
31from lsst.images.cells
import CellCoadd
33from lsst.pipe.base
import (
34 InputQuantizedConnection,
35 OutputQuantizedConnection,
38 PipelineTaskConnections,
46 PipelineTaskConnections,
47 dimensions={
"patch",
"band"},
48 defaultTemplates={
"legacy_prefix":
"legacy_",
"future_prefix":
""},
50 legacy_exposure = cT.Input(
51 "{legacy_prefix}template_coadd",
52 storageClass=
"ExposureF",
53 dimensions={
"patch",
"band"},
54 doc=
"The lazy-PSF Exposure coadd to convert.",
57 doc=
"Description of the skymap's tracts and patches.",
58 name=BaseSkyMap.SKYMAP_DATASET_TYPE_NAME,
59 storageClass=
"SkyMap",
60 dimensions=(
"skymap",),
62 future_cell_coadd = cT.Output(
63 "{future_prefix}template_coadd",
64 storageClass=
"CellCoadd",
65 dimensions={
"patch",
"band"},
66 doc=
"The output CellCoadd.",
69 config: RewriteLazyCoaddConfig
72class RewriteLazyCoaddConfig(
74 pipelineConnections=RewriteLazyCoaddConnections,
77 "Name of the instrument assumed for all inputs to this coadd.",
83class RewriteLazyCoaddTask(PipelineTask):
84 ConfigClass: ClassVar[type[RewriteLazyCoaddConfig]] = RewriteLazyCoaddConfig
85 config: RewriteLazyCoaddConfig
86 _DefaultName =
"rewriteLazyCoadd"
90 butlerQC: QuantumContext,
91 inputRefs: InputQuantizedConnection,
92 outputRefs: OutputQuantizedConnection,
94 inputs = butlerQC.get(inputRefs)
95 outputs = self.run(**inputs, data_id=butlerQC.quantum.dataId)
96 butlerQC.put(outputs, outputRefs)
100 legacy_exposure: LegacyExposure,
102 data_id: DataCoordinate,
104 future_cell_coadd = CellCoadd.from_legacy_lazy_coadd(
106 instrument=self.config.instrument,
107 tract_info=sky_map[data_id[
"tract"]],
108 patch=data_id[
"patch"],
109 band=data_id[
"band"],
111 return Struct(future_cell_coadd=future_cell_coadd)