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 | Public Attributes | Static Public Attributes | List of all members
lsst.meas.base.references.CoaddSrcReferencesTask Class Reference

A references task implementation that loads the coadd_datasetSuffix dataset directly from disk using the butler. More...

Inheritance diagram for lsst.meas.base.references.CoaddSrcReferencesTask:
lsst.meas.base.references.BaseReferencesTask lsst.meas.base.references.MultiBandReferencesTask

Public Member Functions

def __init__
 Initialize the task. More...
 
def getWcs
 
def fetchInPatches
 An implementation of BaseReferencesTask.fetchInPatches that loads 'coadd_' + datasetSuffix catalogs using the butler. More...
 
def fetchInBox
 Return reference sources that overlap a region defined by a pixel-coordinate bounding box and corresponding Wcs. More...
 
- Public Member Functions inherited from lsst.meas.base.references.BaseReferencesTask
def __init__
 Initialize the task. More...
 
def getSchema
 Return the schema for the reference sources. More...
 
def getWcs
 Return the WCS for reference sources. More...
 
def fetchInBox
 Return reference sources that overlap a region defined by a pixel-coordinate bounding box and corresponding Wcs. More...
 
def fetchInPatches
 Return reference sources that overlap a region defined by one or more SkyMap patches. More...
 
def subset
 Filter sources to contain only those within the given box, defined in the coordinate system defined by the given Wcs. More...
 

Public Attributes

 schema
 

Static Public Attributes

 ConfigClass = CoaddSrcReferencesConfig
 
string datasetSuffix = "src"
 
- Static Public Attributes inherited from lsst.meas.base.references.BaseReferencesTask
 ConfigClass = BaseReferencesConfig
 

Detailed Description

A references task implementation that loads the coadd_datasetSuffix dataset directly from disk using the butler.

Definition at line 169 of file references.py.

Constructor & Destructor Documentation

def lsst.meas.base.references.CoaddSrcReferencesTask.__init__ (   self,
  butler = None,
  schema = None,
  kwargs 
)

Initialize the task.

Additional keyword arguments (forwarded to BaseReferencesTask.__init__):

  • schema: the schema of the detection catalogs used as input to this one
  • butler: a butler used to read the input schema from disk, if schema is None The task will set its own self.schema attribute to the schema of the output merged catalog.

Definition at line 178 of file references.py.

179  def __init__(self, butler=None, schema=None, **kwargs):
180  """! Initialize the task.
181  Additional keyword arguments (forwarded to BaseReferencesTask.__init__):
182  - schema: the schema of the detection catalogs used as input to this one
183  - butler: a butler used to read the input schema from disk, if schema is None
184  The task will set its own self.schema attribute to the schema of the output merged catalog.
185  """
186  BaseReferencesTask.__init__(self, butler=butler, schema=schema, **kwargs)
187  if schema is None:
188  assert butler is not None, "No butler nor schema provided"
189  schema = butler.get("{}Coadd_{}_schema".format(self.config.coaddName, self.datasetSuffix),
190  immediate=True).getSchema()
191  self.schema = schema
def getSchema
Return the schema for the reference sources.
Definition: references.py:71

Member Function Documentation

def lsst.meas.base.references.CoaddSrcReferencesTask.fetchInBox (   self,
  dataRef,
  bbox,
  wcs,
  pad = 0 
)

Return reference sources that overlap a region defined by a pixel-coordinate bounding box and corresponding Wcs.

Parameters
[in]dataRefButlerDataRef; the implied data ID must contain the 'tract' key.
[in]bboxa afw.geom.Box2I or Box2D that defines the region in pixel coordinates
[in]wcsafw.image.Wcs that maps the bbox to sky coordinates
[in]pada buffer to grow the bounding box by after catalogs have been loaded, but before filtering them to include just the given bounding box.
Returns
an iterable of reference sources

Definition at line 226 of file references.py.

227  def fetchInBox(self, dataRef, bbox, wcs, pad=0):
228  """!
229  Return reference sources that overlap a region defined by a pixel-coordinate bounding box
230  and corresponding Wcs.
231 
232  @param[in] dataRef ButlerDataRef; the implied data ID must contain the 'tract' key.
233  @param[in] bbox a afw.geom.Box2I or Box2D that defines the region in pixel coordinates
234  @param[in] wcs afw.image.Wcs that maps the bbox to sky coordinates
235  @param[in] pad a buffer to grow the bounding box by after catalogs have been loaded, but
236  before filtering them to include just the given bounding box.
237 
238  @return an iterable of reference sources
239  """
240  skyMap = dataRef.get(self.config.coaddName + "Coadd_skyMap", immediate=True)
241  tract = skyMap[dataRef.dataId["tract"]]
242  coordList = [wcs.pixelToSky(corner) for corner in lsst.afw.geom.Box2D(bbox).getCorners()]
243  self.log.info("Getting references in region with corners %s [degrees]" %
244  ", ".join("(%s)" % coord.getPosition(lsst.afw.geom.degrees) for coord in coordList))
245  patchList = tract.findPatchList(coordList)
246  # After figuring out which patch catalogs to read from the bbox, pad out the bbox if desired
247  # But don't add any new patches while padding
248  if pad:
249  bbox.grow(pad)
250  return self.subset(self.fetchInPatches(dataRef, patchList), bbox, wcs)
251 
def subset
Filter sources to contain only those within the given box, defined in the coordinate system defined b...
Definition: references.py:121
def fetchInBox
Return reference sources that overlap a region defined by a pixel-coordinate bounding box and corresp...
Definition: references.py:226
def fetchInPatches
Return reference sources that overlap a region defined by one or more SkyMap patches.
Definition: references.py:103
A floating-point coordinate rectangle geometry.
Definition: Box.h:271
def lsst.meas.base.references.CoaddSrcReferencesTask.fetchInPatches (   self,
  dataRef,
  patchList 
)

An implementation of BaseReferencesTask.fetchInPatches that loads 'coadd_' + datasetSuffix catalogs using the butler.

The given dataRef must include the tract in its dataId.

Definition at line 198 of file references.py.

199  def fetchInPatches(self, dataRef, patchList):
200  """!
201  An implementation of BaseReferencesTask.fetchInPatches that loads 'coadd_' + datasetSuffix
202  catalogs using the butler.
203 
204  The given dataRef must include the tract in its dataId.
205  """
206  dataset = "{}Coadd_{}".format(self.config.coaddName, self.datasetSuffix)
207  tract = dataRef.dataId["tract"]
208  butler = dataRef.butlerSubset.butler
209  for patch in patchList:
210  dataId = {'tract': tract, 'patch': "%d,%d" % patch.getIndex()}
211  if self.config.filter is not None:
212  dataId['filter'] = self.config.filter
213 
214  if not butler.datasetExists(dataset, dataId):
215  raise lsst.pipe.base.TaskError("Reference %s doesn't exist" % (dataId,))
216  self.log.info("Getting references in %s" % (dataId,))
217  catalog = butler.get(dataset, dataId, immediate=True)
218  if self.config.removePatchOverlaps:
219  bbox = lsst.afw.geom.Box2D(patch.getInnerBBox())
220  for source in catalog:
221  if bbox.contains(source.getCentroid()):
222  yield source
223  else:
224  for source in catalog:
225  yield source
A floating-point coordinate rectangle geometry.
Definition: Box.h:271
def fetchInPatches
An implementation of BaseReferencesTask.fetchInPatches that loads 'coadd_' + datasetSuffix catalogs u...
Definition: references.py:198
def lsst.meas.base.references.CoaddSrcReferencesTask.getWcs (   self,
  dataRef 
)
Return the WCS for reference sources.  The given dataRef must include the tract in its dataId.

Definition at line 192 of file references.py.

193  def getWcs(self, dataRef):
194  """Return the WCS for reference sources. The given dataRef must include the tract in its dataId.
195  """
196  skyMap = dataRef.get(self.config.coaddName + "Coadd_skyMap", immediate=True)
197  return skyMap[dataRef.dataId["tract"]].getWcs()

Member Data Documentation

lsst.meas.base.references.CoaddSrcReferencesTask.ConfigClass = CoaddSrcReferencesConfig
static

Definition at line 175 of file references.py.

string lsst.meas.base.references.CoaddSrcReferencesTask.datasetSuffix = "src"
static

Definition at line 176 of file references.py.

lsst.meas.base.references.CoaddSrcReferencesTask.schema

Definition at line 190 of file references.py.


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