LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+0dd8ce4237,g1470d8bcf6+3ea6592b6f,g2079a07aa2+86d27d4dc4,g2305ad1205+5ca4c0b359,g295015adf3+d10818ec9d,g2a9a014e59+6f9be1b9cd,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+703ba97ebf,g487adcacf7+4fa16da234,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+ffa42b374e,g5a732f18d5+53520f316c,g64a986408d+0dd8ce4237,g858d7b2824+0dd8ce4237,g8a8a8dda67+585e252eca,g99cad8db69+d39438377f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+f1d96605c8,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+e5339d463f,gc120e1dc64+da31e9920e,gc28159a63d+0e5473021a,gcf0d15dbbd+703ba97ebf,gdaeeff99f8+f9a426f77a,ge6526c86ff+889fc9d533,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf18bd8381d+7268b93478,gff1a9f87cc+0dd8ce4237,w.2024.16
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lsst.pipe.tasks.selectImages.WcsSelectImagesTask Class Reference
Inheritance diagram for lsst.pipe.tasks.selectImages.WcsSelectImagesTask:
lsst.pipe.tasks.selectImages.BaseSelectImagesTask

Public Member Functions

 run (self, wcsList, bboxList, coordList, dataIds=None, **kwargs)
 
 getValidImageCorners (self, imageWcs, imageBox, patchPoly, dataId=None)
 

Detailed Description

Select images using their Wcs.

We use the "convexHull" method of lsst.sphgeom.ConvexPolygon to define
polygons on the celestial sphere, and test the polygon of the
patch for overlap with the polygon of the image.

We use "convexHull" instead of generating a ConvexPolygon
directly because the standard for the inputs to ConvexPolygon
are pretty high and we don't want to be responsible for reaching them.

Definition at line 162 of file selectImages.py.

Member Function Documentation

◆ getValidImageCorners()

lsst.pipe.tasks.selectImages.WcsSelectImagesTask.getValidImageCorners ( self,
imageWcs,
imageBox,
patchPoly,
dataId = None )
Return corners or `None` if bad.

Parameters
----------
imageWcs : `Unknown`
imageBox : `Unknown`
patchPoly : `Unknown`
dataId : `Unknown`

Definition at line 209 of file selectImages.py.

209 def getValidImageCorners(self, imageWcs, imageBox, patchPoly, dataId=None):
210 """Return corners or `None` if bad.
211
212 Parameters
213 ----------
214 imageWcs : `Unknown`
215 imageBox : `Unknown`
216 patchPoly : `Unknown`
217 dataId : `Unknown`
218 """
219 try:
220 imageCorners = [imageWcs.pixelToSky(pix) for pix in geom.Box2D(imageBox).getCorners()]
222 # Protecting ourselves from awful Wcs solutions in input images
223 self.log.debug("WCS error in testing calexp %s (%s): deselecting", dataId, e)
224 return None
225
226 imagePoly = lsst.sphgeom.ConvexPolygon.convexHull([coord.getVector() for coord in imageCorners])
227 if imagePoly is None:
228 self.log.debug("Unable to create polygon from image %s: deselecting", dataId)
229 return None
230
231 if patchPoly.intersects(imagePoly):
232 # "intersects" also covers "contains" or "is contained by"
233 self.log.info("Selecting calexp %s", dataId)
234 return imageCorners
235
236 return None
237
238
A floating-point coordinate rectangle geometry.
Definition Box.h:413
Reports arguments outside the domain of an operation.
Definition Runtime.h:57
Reports errors that are due to events beyond the control of the program.
Definition Runtime.h:104
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...

◆ run()

lsst.pipe.tasks.selectImages.WcsSelectImagesTask.run ( self,
wcsList,
bboxList,
coordList,
dataIds = None,
** kwargs )
Return indices of provided lists that meet the selection criteria.

Parameters
----------
wcsList : `list` [`lsst.afw.geom.SkyWcs`]
    Specifying the WCS's of the input ccds to be selected.
bboxList : `list` [`lsst.geom.Box2I`]
    Specifying the bounding boxes of the input ccds to be selected.
coordList : `list` [`lsst.geom.SpherePoint`]
    ICRS coordinates specifying boundary of the patch.
dataIds : iterable [`lsst.daf.butler.dataId`] or `None`, optional
    An iterable object of dataIds which point to reference catalogs.
**kwargs
    Additional keyword arguments.

Returns
-------
result : `list` [`int`]
    The indices of selected ccds.

Reimplemented from lsst.pipe.tasks.selectImages.BaseSelectImagesTask.

Definition at line 174 of file selectImages.py.

174 def run(self, wcsList, bboxList, coordList, dataIds=None, **kwargs):
175 """Return indices of provided lists that meet the selection criteria.
176
177 Parameters
178 ----------
179 wcsList : `list` [`lsst.afw.geom.SkyWcs`]
180 Specifying the WCS's of the input ccds to be selected.
181 bboxList : `list` [`lsst.geom.Box2I`]
182 Specifying the bounding boxes of the input ccds to be selected.
183 coordList : `list` [`lsst.geom.SpherePoint`]
184 ICRS coordinates specifying boundary of the patch.
185 dataIds : iterable [`lsst.daf.butler.dataId`] or `None`, optional
186 An iterable object of dataIds which point to reference catalogs.
187 **kwargs
188 Additional keyword arguments.
189
190 Returns
191 -------
192 result : `list` [`int`]
193 The indices of selected ccds.
194 """
195 if dataIds is None:
196 dataIds = [None] * len(wcsList)
197 patchVertices = [coord.getVector() for coord in coordList]
198 patchPoly = lsst.sphgeom.ConvexPolygon.convexHull(patchVertices)
199 result = []
200 for i, (imageWcs, imageBox, dataId) in enumerate(zip(wcsList, bboxList, dataIds)):
201 if imageWcs is None:
202 self.log.info("De-selecting exposure %s: Exposure has no WCS.", dataId)
203 else:
204 imageCorners = self.getValidImageCorners(imageWcs, imageBox, patchPoly, dataId)
205 if imageCorners:
206 result.append(i)
207 return result
208

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