LSST Applications  21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
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 174 of file selectImages.py.

Member Function Documentation

◆ getValidImageCorners()

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

Definition at line 246 of file selectImages.py.

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

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

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

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

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

Member Data Documentation

◆ ConfigClass

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

Definition at line 76 of file selectImages.py.


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