LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
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

def runDataRef
 
- Public Member Functions inherited from lsst.pipe.tasks.selectImages.BaseSelectImagesTask
def run
 
def runDataRef
 

Additional Inherited Members

- Static Public Attributes inherited from lsst.pipe.tasks.selectImages.BaseSelectImagesTask
 ConfigClass = pexConfig.Config
 

Detailed Description

Select images using their Wcs

Definition at line 164 of file selectImages.py.

Member Function Documentation

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

We use the "convexHull" function in the geom package 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 SphericalConvexPolygon
directly because the standard for the inputs to SphericalConvexPolygon
are pretty high and we don't want to be responsible for reaching them.
If "convexHull" is found to be too slow, we can revise this.

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

Definition at line 166 of file selectImages.py.

167  def runDataRef(self, dataRef, coordList, makeDataRefList=True, selectDataList=[]):
168  """Select images in the selectDataList that overlap the patch
169 
170  We use the "convexHull" function in the geom package to define
171  polygons on the celestial sphere, and test the polygon of the
172  patch for overlap with the polygon of the image.
173 
174  We use "convexHull" instead of generating a SphericalConvexPolygon
175  directly because the standard for the inputs to SphericalConvexPolygon
176  are pretty high and we don't want to be responsible for reaching them.
177  If "convexHull" is found to be too slow, we can revise this.
178 
179  @param dataRef: Data reference for coadd/tempExp (with tract, patch)
180  @param coordList: List of Coord specifying boundary of patch
181  @param makeDataRefList: Construct a list of data references?
182  @param selectDataList: List of SelectStruct, to consider for selection
183  """
184  from lsst.geom import convexHull
185 
186  dataRefList = []
187  exposureInfoList = []
188 
189  patchVertices = [coord.getVector() for coord in coordList]
190  patchPoly = convexHull(patchVertices)
191 
192  for data in selectDataList:
193  dataRef = data.dataRef
194  imageWcs = data.wcs
195  nx,ny = data.dims
196 
197  imageBox = afwGeom.Box2D(afwGeom.Point2D(0,0), afwGeom.Extent2D(nx, ny))
198  try:
199  imageCorners = [imageWcs.pixelToSky(pix) for pix in imageBox.getCorners()]
200  except (pexExceptions.DomainError, pexExceptions.RuntimeError) as e:
201  # Protecting ourselves from awful Wcs solutions in input images
202  self.log.logdebug("WCS error in testing calexp %s (%s): deselecting" % (dataRef.dataId, e))
203  continue
204 
205  imagePoly = convexHull([coord.getVector() for coord in imageCorners])
206  if patchPoly.intersects(imagePoly): # "intersects" also covers "contains" or "is contained by"
207  self.log.info("Selecting calexp %s" % dataRef.dataId)
208  dataRefList.append(dataRef)
209  exposureInfoList.append(BaseExposureInfo(dataRef.dataId, imageCorners))
210 
211  return pipeBase.Struct(
212  dataRefList = dataRefList if makeDataRefList else None,
213  exposureInfoList = exposureInfoList,
214  )
A floating-point coordinate rectangle geometry.
Definition: Box.h:271

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