23 from lsst.daf.butler
import DatasetType
28 """Config for MakeGen3SkyMapTask 30 datasetTypeName = pexConfig.Field(
31 doc=
"Name assigned to created skymap in butler registry",
33 default=
"deepCoadd_skyMap",
35 name = pexConfig.Field(
36 doc=
"Name assigned to created skymap in butler registry",
41 skyMap = skyMapRegistry.makeField(
48 raise ValueError(
"The name field must be set to the name of the specific " 49 "skymap to use when writing to the butler")
53 ConfigClass = MakeGen3SkyMapConfig
54 _DefaultName =
"makeGen3SkyMap" 56 """This is a task to construct and optionally save a SkyMap into a gen3 61 config : `MakeGen3SkyMapConfig` or None 62 Instance of a configuration class specifying task options, a default 63 config is created if value is None 67 super().
__init__(config=config, **kwargs)
69 def run(self, butler):
70 """Construct and optionally save a SkyMap into a gen3 repository 73 butler : `lsst.daf.butler.Butler` 74 Butler repository to which the new skymap will be written 76 skyMap = self.config.skyMap.apply()
77 skyMap.logSkyMapInfo(self.log)
78 skyMapHash = skyMap.getSha1()
80 existing, = butler.registry.query(
"SELECT skymap FROM skymap WHERE hash=:hash",
83 (f
"SkyMap with name {existing.name} and hash {skyMapHash} already exist in " 84 f
"the butler collection {self.collection}, SkyMaps must be unique within " 88 self.log.
info(f
"Inserting SkyMap {self.config.name} with hash={skyMapHash}")
89 with butler.registry.transaction():
90 skyMap.register(self.config.name, butler.registry)
91 butler.registry.registerDatasetType(DatasetType(name=self.config.datasetTypeName,
92 dimensions=[
"skymap"],
93 storageClass=
"SkyMap"))
94 butler.put(skyMap, self.config.datasetTypeName, {
"skymap": self.config.name})
96 return pipeBase.Struct(
def __init__(self, config=None, kwargs)