lsst.pipe.tasks  20.0.0-46-gd70f10e1+f17cbaf3d1
makeGen3SkyMap.py
Go to the documentation of this file.
1 # This file is part of pipe_tasks.
2 #
3 # Developed for the LSST Data Management System.
4 # This product includes software developed by the LSST Project
5 # (https://www.lsst.org).
6 # See the COPYRIGHT file at the top-level directory of this distribution
7 # for details of code ownership.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 import lsst.pex.config as pexConfig
22 import lsst.pipe.base as pipeBase
23 from lsst.skymap import skyMapRegistry
24 
25 
26 class MakeGen3SkyMapConfig(pexConfig.Config):
27  """Config for MakeGen3SkyMapTask
28  """
29  name = pexConfig.Field(
30  doc="Name assigned to created skymap in butler registry",
31  dtype=str,
32  default=None,
33  optional=True
34  )
35  skyMap = skyMapRegistry.makeField(
36  doc="type of skyMap",
37  default="dodeca",
38  )
39 
40  def validate(self):
41  if self.name is None:
42  raise ValueError("The name field must be set to the name of the specific "
43  "skymap to use when writing to the butler")
44 
45 
46 class MakeGen3SkyMapTask(pipeBase.Task):
47  ConfigClass = MakeGen3SkyMapConfig
48  _DefaultName = "makeGen3SkyMap"
49 
50  """This is a task to construct and optionally save a SkyMap into a gen3
51  butler repository.
52 
53  Parameters
54  ----------
55  config : `MakeGen3SkyMapConfig` or None
56  Instance of a configuration class specifying task options, a default
57  config is created if value is None
58  """
59 
60  def __init__(self, *, config=None, **kwargs):
61  super().__init__(config=config, **kwargs)
62 
63  def run(self, butler):
64  """Construct and optionally save a SkyMap into a gen3 repository
65  Parameters
66  ----------
67  butler : `lsst.daf.butler.Butler`
68  Butler repository to which the new skymap will be written
69  """
70  skyMap = self.config.skyMap.apply()
71  skyMap.logSkyMapInfo(self.log)
72  skyMap.register(self.config.name, butler)
73  return pipeBase.Struct(
74  skyMap=skyMap
75  )
lsst.pipe.tasks.makeGen3SkyMap.MakeGen3SkyMapTask.__init__
def __init__(self, *config=None, **kwargs)
Definition: makeGen3SkyMap.py:60
lsst.pipe.tasks.makeGen3SkyMap.MakeGen3SkyMapTask.run
def run(self, butler)
Definition: makeGen3SkyMap.py:63
lsst.pipe.tasks.makeGen3SkyMap.MakeGen3SkyMapConfig.name
name
Definition: makeGen3SkyMap.py:29
lsst.pipe.tasks.makeGen3SkyMap.MakeGen3SkyMapConfig
Definition: makeGen3SkyMap.py:26
lsst::pex::config
lsst.pipe.tasks.makeGen3SkyMap.MakeGen3SkyMapTask
Definition: makeGen3SkyMap.py:46
lsst.pipe.tasks.makeGen3SkyMap.MakeGen3SkyMapConfig.validate
def validate(self)
Definition: makeGen3SkyMap.py:40
lsst::skymap
lsst.pipe::base