LSST Applications g02d81e74bb+86cf3d8bc9,g180d380827+7a4e862ed4,g2079a07aa2+86d27d4dc4,g2305ad1205+e1ca1c66fa,g29320951ab+012e1474a1,g295015adf3+341ea1ce94,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+c429d67c83,g48712c4677+f88676dd22,g487adcacf7+27e1e21933,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+b41db86c35,g5a732f18d5+53520f316c,g64a986408d+86cf3d8bc9,g858d7b2824+86cf3d8bc9,g8a8a8dda67+585e252eca,g99cad8db69+84912a7fdc,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+a2b54eae19,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+6681f309db,gc120e1dc64+f0fcc2f6d8,gc28159a63d+0e5473021a,gcf0d15dbbd+c429d67c83,gdaeeff99f8+f9a426f77a,ge6526c86ff+0433e6603d,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+86cf3d8bc9,w.2024.17
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Static Protected Attributes | List of all members
lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask Class Reference
Inheritance diagram for lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask:

Public Member Functions

 run (self, wcs_bbox_tuple_list, oldSkyMap=None)
 

Static Public Attributes

 ConfigClass = MakeDiscreteSkyMapConfig
 

Static Protected Attributes

str _DefaultName = "makeDiscreteSkyMap"
 

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 66 of file makeDiscreteSkyMap.py.

Member Function Documentation

◆ run()

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`, optional
   The SkyMap to extend if appending.

Returns
-------
skyMap : `lsst.pipe.base.Struct`
    Sky map returned as a struct with attributes:

    ``skyMap``
        The returned SkyMap (`lsst.skyMap.SkyMap`).

Definition at line 77 of file makeDiscreteSkyMap.py.

77 def run(self, wcs_bbox_tuple_list, oldSkyMap=None):
78 """Make a SkyMap from the bounds of the given set of calexp metadata.
79
80 Parameters
81 ----------
82 wcs_bbox_tuple_list : `iterable`
83 A list of tuples with each element expected to be a (Wcs, Box2I) pair.
84 oldSkyMap : `lsst.skymap.DiscreteSkyMap`, optional
85 The SkyMap to extend if appending.
86
87 Returns
88 -------
89 skyMap : `lsst.pipe.base.Struct`
90 Sky map returned as a struct with attributes:
91
92 ``skyMap``
93 The returned SkyMap (`lsst.skyMap.SkyMap`).
94 """
95 self.log.info("Extracting bounding boxes of %d images", len(wcs_bbox_tuple_list))
96 points = []
97 for wcs, boxI in wcs_bbox_tuple_list:
98 boxD = geom.Box2D(boxI)
99 points.extend(wcs.pixelToSky(corner).getVector() for corner in boxD.getCorners())
100 if len(points) == 0:
101 raise RuntimeError("No data found from which to compute convex hull")
102 self.log.info("Computing spherical convex hull")
104 if polygon is None:
105 raise RuntimeError(
106 "Failed to compute convex hull of the vertices of all calexp bounding boxes; "
107 "they may not be hemispherical."
108 )
109 circle = polygon.getBoundingCircle()
110
111 skyMapConfig = DiscreteSkyMap.ConfigClass()
112 if oldSkyMap:
113 skyMapConfig.raList.extend(oldSkyMap.config.raList)
114 skyMapConfig.decList.extend(oldSkyMap.config.decList)
115 skyMapConfig.radiusList.extend(oldSkyMap.config.radiusList)
116 configIntersection = {k: getattr(self.config.skyMap, k)
117 for k in self.config.skyMap.toDict()
118 if k in skyMapConfig}
119 skyMapConfig.update(**configIntersection)
120 circleCenter = lsst.sphgeom.LonLat(circle.getCenter())
121 skyMapConfig.raList.append(circleCenter[0].asDegrees())
122 skyMapConfig.decList.append(circleCenter[1].asDegrees())
123 circleRadiusDeg = circle.getOpeningAngle().asDegrees()
124 skyMapConfig.radiusList.append(circleRadiusDeg + self.config.borderSize)
125 skyMap = DiscreteSkyMap(skyMapConfig)
126
127 for tractInfo in skyMap:
128 wcs = tractInfo.getWcs()
129 posBox = geom.Box2D(tractInfo.getBBox())
130 pixelPosList = (
131 posBox.getMin(),
132 geom.Point2D(posBox.getMaxX(), posBox.getMinY()),
133 posBox.getMax(),
134 geom.Point2D(posBox.getMinX(), posBox.getMaxY()),
135 )
136 skyPosList = [wcs.pixelToSky(pos).getPosition(geom.degrees) for pos in pixelPosList]
137 posStrList = ["(%0.3f, %0.3f)" % tuple(skyPos) for skyPos in skyPosList]
138 self.log.info("tract %s has corners %s (RA, Dec deg) and %s x %s patches",
139 tractInfo.getId(), ", ".join(posStrList),
140 tractInfo.getNumPatches()[0], tractInfo.getNumPatches()[1])
141 return pipeBase.Struct(
142 skyMap=skyMap
143 )
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...
LonLat represents a spherical coordinate (longitude/latitude angle) pair.
Definition LonLat.h:55

Member Data Documentation

◆ _DefaultName

str lsst.pipe.tasks.makeDiscreteSkyMap.MakeDiscreteSkyMapTask._DefaultName = "makeDiscreteSkyMap"
staticprotected

Definition at line 74 of file makeDiscreteSkyMap.py.

◆ ConfigClass

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

Definition at line 73 of file makeDiscreteSkyMap.py.


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