32 """Config for MakeSkyMapTask
34 coaddName = pexConfig.Field(
35 doc =
"coadd name, e.g. deep, goodSeeing, chiSquared",
39 skyMap = skyMapRegistry.makeField(
40 doc =
"type of skyMap",
43 doWrite = pexConfig.Field(
44 doc =
"persist the skyMap? If False then run generates the sky map and returns it, " \
45 +
"but does not save it to the data repository",
52 """Only need a single butler instance to run on."""
55 return [parsedCmd.butler]
65 task = self.TaskClass(config=self.config, log=self.log)
67 results = task.run(butler)
70 results = task.run(butler)
72 task.log.fatal(
"Failed: %s" % e)
73 if not isinstance(e, pipeBase.TaskError):
74 traceback.print_exc(file=sys.stderr)
75 task.writeMetadata(butler)
76 if self.doReturnResults:
80 """!Make a sky map in a repository
82 Making a sky map in a repository is a prerequisite for making a coadd,
83 since the sky map is used as the pixelization for the coadd.
85 ConfigClass = MakeSkyMapConfig
86 _DefaultName =
"makeSkyMap"
87 RunnerClass = MakeSkyMapRunner
90 pipeBase.CmdLineTask.__init__(self, **kwargs)
93 def run(self, butler):
94 """!Make a skymap, persist it (optionally) and log some information about it
96 @param[in] butler data butler
97 @return a pipeBase Struct containing:
98 - skyMap: the constructed SkyMap
100 skyMap = self.config.skyMap.apply()
102 if self.config.doWrite:
103 butler.put(skyMap, self.config.coaddName +
"Coadd_skyMap")
104 return pipeBase.Struct(
109 """!Log information about a sky map
111 @param[in] skyMap sky map (an lsst.skyMap.SkyMap)
113 self.log.info(
"sky map has %s tracts" % (len(skyMap),))
114 for tractInfo
in skyMap:
115 wcs = tractInfo.getWcs()
123 skyPosList = [wcs.pixelToSky(pos).getPosition(afwGeom.degrees)
for pos
in pixelPosList]
124 posStrList = [
"(%0.3f, %0.3f)" % tuple(skyPos)
for skyPos
in skyPosList]
125 self.log.info(
"tract %s has corners %s (RA, Dec deg) and %s x %s patches" % \
126 (tractInfo.getId(),
", ".join(posStrList), \
127 tractInfo.getNumPatches()[0], tractInfo.getNumPatches()[1]))
131 """Create an argument parser
133 No identifiers are added because none are used.
135 return pipeBase.ArgumentParser(name=cls._DefaultName)
138 """Return the name of the config dataset
140 return "%s_makeSkyMap_config" % (self.config.coaddName,)
143 """Return the name of the metadata dataset
145 return "%s_makeSkyMap_metadata" % (self.config.coaddName,)
def run
Make a skymap, persist it (optionally) and log some information about it.
def logSkyMapInfo
Log information about a sky map.
A floating-point coordinate rectangle geometry.
Make a sky map in a repository.