LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Static Public Attributes | List of all members
lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask Class Reference

Make a DiscreteSkyMap in a repository, using the bounding box of a set of calexps. More...

Inheritance diagram for lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask:

Public Member Functions

def __init__ (self, **kwargs)
 
def runDataRef (self, butler, dataRefList)
 
def run (self, wcs_bbox_tuple_list, oldSkyMap=None)
 

Static Public Attributes

 ConfigClass = MakeDiscreteSkyMapConfig
 
 RunnerClass = MakeDiscreteSkyMapRunner
 

Detailed Description

Make a DiscreteSkyMap in a repository, using the bounding box of a set of calexps.

The command-line and run signatures and config are sufficiently different from MakeSkyMapTask
that we don't inherit from it, but it is a replacement, so we use the same config/metadata names.

Definition at line 118 of file makeDiscreteSkyMap.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask.__init__ (   self,
**  kwargs 
)

Definition at line 128 of file makeDiscreteSkyMap.py.

128  def __init__(self, **kwargs):
129  super().__init__(**kwargs)
130 

Member Function Documentation

◆ run()

def lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask.run (   self,
  wcs_bbox_tuple_list,
  oldSkyMap = None 
)
Make a SkyMap from the bounds of the given set of calexp metadata.

Parameters
----------
wcs_bbox_tuple_list : iterable
   A list of tuples with each element expected to be a (Wcs, Box2I) pair
oldSkyMap : `lsst.skymap.DiscreteSkyMap`, option
   The SkyMap to extend if appending
Returns
-------
struct : `lsst.pipe.base.Struct
   The returned struct has one attribute, ``skyMap``, which holds the returned SkyMap

Definition at line 167 of file makeDiscreteSkyMap.py.

167  def run(self, wcs_bbox_tuple_list, oldSkyMap=None):
168  """Make a SkyMap from the bounds of the given set of calexp metadata.
169 
170  Parameters
171  ----------
172  wcs_bbox_tuple_list : iterable
173  A list of tuples with each element expected to be a (Wcs, Box2I) pair
174  oldSkyMap : `lsst.skymap.DiscreteSkyMap`, option
175  The SkyMap to extend if appending
176  Returns
177  -------
178  struct : `lsst.pipe.base.Struct
179  The returned struct has one attribute, ``skyMap``, which holds the returned SkyMap
180  """
181  self.log.info("Extracting bounding boxes of %d images", len(wcs_bbox_tuple_list))
182  points = []
183  for wcs, boxI in wcs_bbox_tuple_list:
184  boxD = geom.Box2D(boxI)
185  points.extend(wcs.pixelToSky(corner).getVector() for corner in boxD.getCorners())
186  if len(points) == 0:
187  raise RuntimeError("No data found from which to compute convex hull")
188  self.log.info("Computing spherical convex hull")
189  polygon = lsst.sphgeom.ConvexPolygon.convexHull(points)
190  if polygon is None:
191  raise RuntimeError(
192  "Failed to compute convex hull of the vertices of all calexp bounding boxes; "
193  "they may not be hemispherical."
194  )
195  circle = polygon.getBoundingCircle()
196 
197  skyMapConfig = DiscreteSkyMap.ConfigClass()
198  if oldSkyMap:
199  skyMapConfig.raList.extend(oldSkyMap.config.raList)
200  skyMapConfig.decList.extend(oldSkyMap.config.decList)
201  skyMapConfig.radiusList.extend(oldSkyMap.config.radiusList)
202  configIntersection = {k: getattr(self.config.skyMap, k)
203  for k in self.config.skyMap.toDict()
204  if k in skyMapConfig}
205  skyMapConfig.update(**configIntersection)
206  circleCenter = lsst.sphgeom.LonLat(circle.getCenter())
207  skyMapConfig.raList.append(circleCenter[0].asDegrees())
208  skyMapConfig.decList.append(circleCenter[1].asDegrees())
209  circleRadiusDeg = circle.getOpeningAngle().asDegrees()
210  skyMapConfig.radiusList.append(circleRadiusDeg + self.config.borderSize)
211  skyMap = DiscreteSkyMap(skyMapConfig)
212 
213  for tractInfo in skyMap:
214  wcs = tractInfo.getWcs()
215  posBox = geom.Box2D(tractInfo.getBBox())
216  pixelPosList = (
217  posBox.getMin(),
218  geom.Point2D(posBox.getMaxX(), posBox.getMinY()),
219  posBox.getMax(),
220  geom.Point2D(posBox.getMinX(), posBox.getMaxY()),
221  )
222  skyPosList = [wcs.pixelToSky(pos).getPosition(geom.degrees) for pos in pixelPosList]
223  posStrList = ["(%0.3f, %0.3f)" % tuple(skyPos) for skyPos in skyPosList]
224  self.log.info("tract %s has corners %s (RA, Dec deg) and %s x %s patches",
225  tractInfo.getId(), ", ".join(posStrList),
226  tractInfo.getNumPatches()[0], tractInfo.getNumPatches()[1])
227  return pipeBase.Struct(
228  skyMap=skyMap
229  )
230 
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
static ConvexPolygon convexHull(std::vector< UnitVector3d > const &points)
convexHull returns the convex hull of the given set of points if it exists and throws an exception ot...
Definition: ConvexPolygon.h:65
LonLat represents a spherical coordinate (longitude/latitude angle) pair.
Definition: LonLat.h:48
def run(self, coaddExposures, bbox, wcs)
Definition: getTemplate.py:603

◆ runDataRef()

def lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask.runDataRef (   self,
  butler,
  dataRefList 
)
Make a skymap from the bounds of the given set of calexps using the butler.

Parameters
----------
butler : `lsst.daf.persistence.Butler`
   Gen2 data butler used to save the SkyMap
dataRefList : iterable
   A list of Gen2 data refs of calexps used to determin the size and pointing of the SkyMap
Returns
-------
struct : `lsst.pipe.base.Struct`
   The returned struct has one attribute, ``skyMap``, which holds the returned SkyMap

Definition at line 131 of file makeDiscreteSkyMap.py.

131  def runDataRef(self, butler, dataRefList):
132  """Make a skymap from the bounds of the given set of calexps using the butler.
133 
134  Parameters
135  ----------
136  butler : `lsst.daf.persistence.Butler`
137  Gen2 data butler used to save the SkyMap
138  dataRefList : iterable
139  A list of Gen2 data refs of calexps used to determin the size and pointing of the SkyMap
140  Returns
141  -------
142  struct : `lsst.pipe.base.Struct`
143  The returned struct has one attribute, ``skyMap``, which holds the returned SkyMap
144  """
145  wcs_bbox_tuple_list = []
146  oldSkyMap = None
147  datasetName = self.config.coaddName + "Coadd_skyMap"
148  for dataRef in dataRefList:
149  if not dataRef.datasetExists("calexp"):
150  self.log.warning("CalExp for %s does not exist: ignoring", dataRef.dataId)
151  continue
152  wcs_bbox_tuple_list.append((dataRef.get("calexp_wcs", immediate=True),
153  dataRef.get("calexp_bbox", immediate=True)))
154  if self.config.doAppend and butler.datasetExists(datasetName):
155  oldSkyMap = butler.get(datasetName, immediate=True)
156  if not isinstance(oldSkyMap.config, DiscreteSkyMap.ConfigClass):
157  raise TypeError("Cannot append to existing non-discrete skymap")
158  compareLog = []
159  if not self.config.skyMap.compare(oldSkyMap.config, output=compareLog.append):
160  raise ValueError("Cannot append to existing skymap - configurations differ:", *compareLog)
161  result = self.run(wcs_bbox_tuple_list, oldSkyMap)
162  if self.config.doWrite:
163  butler.put(result.skyMap, datasetName)
164  return result
165 

Member Data Documentation

◆ ConfigClass

lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask.ConfigClass = MakeDiscreteSkyMapConfig
static

Definition at line 124 of file makeDiscreteSkyMap.py.

◆ RunnerClass

lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask.RunnerClass = MakeDiscreteSkyMapRunner
static

Definition at line 126 of file makeDiscreteSkyMap.py.


The documentation for this class was generated from the following file: