LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
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 173 of file selectImages.py.

Member Function Documentation

◆ getValidImageCorners()

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

Definition at line 245 of file selectImages.py.

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

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

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

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

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

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

Member Data Documentation

◆ ConfigClass

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

Definition at line 75 of file selectImages.py.


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