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.selectImages.WcsSelectImagesTask Class Reference
Inheritance diagram for lsst.pipe.tasks.selectImages.WcsSelectImagesTask:
lsst.pipe.tasks.selectImages.BaseSelectImagesTask

Public Member Functions

def runDataRef (self, dataRef, coordList, makeDataRefList=True, selectDataList=[])
 
def run (self, wcsList, bboxList, coordList, dataIds=None, **kwargs)
 
def getValidImageCorners (self, imageWcs, imageBox, patchPoly, dataId=None)
 
def run (self, coordList)
 

Static Public Attributes

 ConfigClass = pexConfig.Config
 

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 175 of file selectImages.py.

Member Function Documentation

◆ getValidImageCorners()

def lsst.pipe.tasks.selectImages.WcsSelectImagesTask.getValidImageCorners (   self,
  imageWcs,
  imageBox,
  patchPoly,
  dataId = None 
)

Definition at line 247 of file selectImages.py.

247  def getValidImageCorners(self, imageWcs, imageBox, patchPoly, dataId=None):
248  "Return corners or None if bad"
249  try:
250  imageCorners = [imageWcs.pixelToSky(pix) for pix in geom.Box2D(imageBox).getCorners()]
252  # Protecting ourselves from awful Wcs solutions in input images
253  self.log.debug("WCS error in testing calexp %s (%s): deselecting", dataId, e)
254  return
255 
256  imagePoly = lsst.sphgeom.ConvexPolygon.convexHull([coord.getVector() for coord in imageCorners])
257  if imagePoly is None:
258  self.log.debug("Unable to create polygon from image %s: deselecting", dataId)
259  return
260 
261  if patchPoly.intersects(imagePoly):
262  # "intersects" also covers "contains" or "is contained by"
263  self.log.info("Selecting calexp %s", dataId)
264  return imageCorners
265 
266 
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...
Definition: ConvexPolygon.h:65

◆ run() [1/2]

def lsst.pipe.tasks.selectImages.BaseSelectImagesTask.run (   self,
  coordList 
)
inherited
Select images suitable for coaddition in a particular region

@param[in] coordList: list of coordinates defining region of interest; if None then select all images
subclasses may add additional keyword arguments, as required

@return a pipeBase Struct containing:
- exposureInfoList: a list of exposure information objects (subclasses of BaseExposureInfo),
    which have at least the following fields:
    - dataId: data ID dictionary
    - coordList: ICRS coordinates of the corners of the exposure (list of lsst.geom.SpherePoint)

Definition at line 81 of file selectImages.py.

81  def run(self, coordList):
82  """Select images suitable for coaddition in a particular region
83 
84  @param[in] coordList: list of coordinates defining region of interest; if None then select all images
85  subclasses may add additional keyword arguments, as required
86 
87  @return a pipeBase Struct containing:
88  - exposureInfoList: a list of exposure information objects (subclasses of BaseExposureInfo),
89  which have at least the following fields:
90  - dataId: data ID dictionary
91  - coordList: ICRS coordinates of the corners of the exposure (list of lsst.geom.SpherePoint)
92  """
93  raise NotImplementedError()
94 
def run(self, coaddExposures, bbox, wcs)
Definition: getTemplate.py:603

◆ run() [2/2]

def 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` of `lsst.afw.geom.SkyWcs`
    specifying the WCS's of the input ccds to be selected
bboxList : `list` of `lsst.geom.Box2I`
    specifying the bounding boxes of the input ccds to be selected
coordList : `list` of `lsst.geom.SpherePoint`
    ICRS coordinates specifying boundary of the patch.

Returns:
--------
result: `list` of `int`
    of indices of selected ccds

Definition at line 219 of file selectImages.py.

219  def run(self, wcsList, bboxList, coordList, dataIds=None, **kwargs):
220  """Return indices of provided lists that meet the selection criteria
221 
222  Parameters:
223  -----------
224  wcsList : `list` of `lsst.afw.geom.SkyWcs`
225  specifying the WCS's of the input ccds to be selected
226  bboxList : `list` of `lsst.geom.Box2I`
227  specifying the bounding boxes of the input ccds to be selected
228  coordList : `list` of `lsst.geom.SpherePoint`
229  ICRS coordinates specifying boundary of the patch.
230 
231  Returns:
232  --------
233  result: `list` of `int`
234  of indices of selected ccds
235  """
236  if dataIds is None:
237  dataIds = [None] * len(wcsList)
238  patchVertices = [coord.getVector() for coord in coordList]
239  patchPoly = lsst.sphgeom.ConvexPolygon.convexHull(patchVertices)
240  result = []
241  for i, (imageWcs, imageBox, dataId) in enumerate(zip(wcsList, bboxList, dataIds)):
242  imageCorners = self.getValidImageCorners(imageWcs, imageBox, patchPoly, dataId)
243  if imageCorners:
244  result.append(i)
245  return result
246 

◆ runDataRef()

def lsst.pipe.tasks.selectImages.WcsSelectImagesTask.runDataRef (   self,
  dataRef,
  coordList,
  makeDataRefList = True,
  selectDataList = [] 
)
Select images in the selectDataList that overlap the patch

This method is the old entry point for the Gen2 commandline tasks and drivers
Will be deprecated in v22.

@param dataRef: Data reference for coadd/tempExp (with tract, patch)
@param coordList: List of ICRS coordinates (lsst.geom.SpherePoint) specifying boundary of patch
@param makeDataRefList: Construct a list of data references?
@param selectDataList: List of SelectStruct, to consider for selection

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

Definition at line 187 of file selectImages.py.

187  def runDataRef(self, dataRef, coordList, makeDataRefList=True, selectDataList=[]):
188  """Select images in the selectDataList that overlap the patch
189 
190  This method is the old entry point for the Gen2 commandline tasks and drivers
191  Will be deprecated in v22.
192 
193  @param dataRef: Data reference for coadd/tempExp (with tract, patch)
194  @param coordList: List of ICRS coordinates (lsst.geom.SpherePoint) specifying boundary of patch
195  @param makeDataRefList: Construct a list of data references?
196  @param selectDataList: List of SelectStruct, to consider for selection
197  """
198  dataRefList = []
199  exposureInfoList = []
200 
201  patchVertices = [coord.getVector() for coord in coordList]
202  patchPoly = lsst.sphgeom.ConvexPolygon.convexHull(patchVertices)
203 
204  for data in selectDataList:
205  dataRef = data.dataRef
206  imageWcs = data.wcs
207  imageBox = data.bbox
208 
209  imageCorners = self.getValidImageCorners(imageWcs, imageBox, patchPoly, dataId=None)
210  if imageCorners:
211  dataRefList.append(dataRef)
212  exposureInfoList.append(BaseExposureInfo(dataRef.dataId, imageCorners))
213 
214  return pipeBase.Struct(
215  dataRefList=dataRefList if makeDataRefList else None,
216  exposureInfoList=exposureInfoList,
217  )
218 

Member Data Documentation

◆ ConfigClass

lsst.pipe.tasks.selectImages.BaseSelectImagesTask.ConfigClass = pexConfig.Config
staticinherited

Definition at line 77 of file selectImages.py.


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