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
Classes | Functions | Variables
lsst.meas.base.forcedPhotCoadd Namespace Reference

Classes

class  ForcedPhotCoaddRunner
 
class  ForcedPhotCoaddConnections
 
class  documentation
 

Functions

def getExposureId (self, dataRef)
 
def fetchReferences (self, dataRef, exposure)
 
def attachFootprints (self, sources, refCat, exposure, refWcs, dataRef)
 
def getExposure (self, dataRef)
 
def writeOutput (self, dataRef, sources)
 
def getSchemaCatalogs (self)
 

Variables

 removePatchOverlaps
 
 exposureIdInfo
 

Function Documentation

◆ attachFootprints()

def lsst.meas.base.forcedPhotCoadd.attachFootprints (   self,
  sources,
  refCat,
  exposure,
  refWcs,
  dataRef 
)
Attach Footprints to source records.

For coadd forced photometry, we use the deblended "heavy"
`~lsst.afw.detection.Footprint`\ s from the single-band measurements
of the same band - because we've guaranteed that the peaks (and hence
child sources) will be consistent across all bands before we get to
measurement, this should yield reasonable deblending for most sources.
It's most likely limitation is that it will not provide good flux
upper limits for sources that were not detected in this band but were
blended with sources that were.

Definition at line 389 of file forcedPhotCoadd.py.

389  def attachFootprints(self, sources, refCat, exposure, refWcs, dataRef):
390  r"""Attach Footprints to source records.
391 
392  For coadd forced photometry, we use the deblended "heavy"
393  `~lsst.afw.detection.Footprint`\ s from the single-band measurements
394  of the same band - because we've guaranteed that the peaks (and hence
395  child sources) will be consistent across all bands before we get to
396  measurement, this should yield reasonable deblending for most sources.
397  It's most likely limitation is that it will not provide good flux
398  upper limits for sources that were not detected in this band but were
399  blended with sources that were.
400  """
401  if self.config.footprintDatasetName is None:
402  return self.measurement.attachTransformedFootprints(sources, refCat, exposure, refWcs)
403 
404  self.log.info("Loading deblended footprints for sources from %s, %s",
405  self.config.footprintDatasetName, dataRef.dataId)
406  fpCat = dataRef.get("%sCoadd_%s" % (self.config.coaddName, self.config.footprintDatasetName),
407  immediate=True)
408  for refRecord, srcRecord in zip(refCat, sources):
409  fpRecord = fpCat.find(refRecord.getId())
410  if fpRecord is None:
411  raise LookupError("Cannot find Footprint for source %s; please check that %sCoadd_%s "
412  "IDs are compatible with reference source IDs" %
413  (srcRecord.getId(), self.config.coaddName,
414  self.config.footprintDatasetName))
415  srcRecord.setFootprint(fpRecord.getFootprint())
416 
def attachFootprints(self, sources, refCat, exposure, refWcs, dataRef)

◆ fetchReferences()

def lsst.meas.base.forcedPhotCoadd.fetchReferences (   self,
  dataRef,
  exposure 
)
Return an iterable of reference sources which overlap the exposure.

Parameters
----------
dataRef : `lsst.daf.persistence.ButlerDataRef`
    Butler data reference corresponding to the image to be measured;
    should have tract, patch, and filter keys.

exposure : `lsst.afw.image.Exposure`
    Unused.

Notes
-----
All work is delegated to the references subtask; see
`CoaddSrcReferencesTask` for information about the default behavior.

Definition at line 364 of file forcedPhotCoadd.py.

364  def fetchReferences(self, dataRef, exposure):
365  """Return an iterable of reference sources which overlap the exposure.
366 
367  Parameters
368  ----------
369  dataRef : `lsst.daf.persistence.ButlerDataRef`
370  Butler data reference corresponding to the image to be measured;
371  should have tract, patch, and filter keys.
372 
373  exposure : `lsst.afw.image.Exposure`
374  Unused.
375 
376  Notes
377  -----
378  All work is delegated to the references subtask; see
379  `CoaddSrcReferencesTask` for information about the default behavior.
380  """
381  skyMap = dataRef.get(self.dataPrefix + "skyMap", immediate=True)
382  tractInfo = skyMap[dataRef.dataId["tract"]]
383  patch = tuple(int(v) for v in dataRef.dataId["patch"].split(","))
384  patchInfo = tractInfo.getPatchInfo(patch)
385  references = lsst.afw.table.SourceCatalog(self.references.schema)
386  references.extend(self.references.fetchInPatches(dataRef, patchList=[patchInfo]))
387  return references
388 
def fetchReferences(self, dataRef, exposure)

◆ getExposure()

def lsst.meas.base.forcedPhotCoadd.getExposure (   self,
  dataRef 
)
Read input exposure on which measurement will be performed.

Parameters
----------
dataRef : `lsst.daf.persistence.ButlerDataRef`
    Butler data reference.

Definition at line 417 of file forcedPhotCoadd.py.

417  def getExposure(self, dataRef):
418  """Read input exposure on which measurement will be performed.
419 
420  Parameters
421  ----------
422  dataRef : `lsst.daf.persistence.ButlerDataRef`
423  Butler data reference.
424  """
425  if self.config.hasFakes:
426  name = "fakes_" + self.config.coaddName + "Coadd_calexp"
427  else:
428  name = self.config.coaddName + "Coadd_calexp"
429 
430  return dataRef.get(name) if dataRef.datasetExists(name) else None
431 

◆ getExposureId()

def lsst.meas.base.forcedPhotCoadd.getExposureId (   self,
  dataRef 
)

Definition at line 361 of file forcedPhotCoadd.py.

361  def getExposureId(self, dataRef):
362  return int(dataRef.get(self.config.coaddName + "CoaddId"))
363 

◆ getSchemaCatalogs()

def lsst.meas.base.forcedPhotCoadd.getSchemaCatalogs (   self)
The schema catalogs that will be used by this task.

Returns
-------
schemaCatalogs : `dict`
    Dictionary mapping dataset type to schema catalog.

Notes
-----
There is only one schema for each type of forced measurement. The
dataset type for this measurement is defined in the mapper.

Definition at line 445 of file forcedPhotCoadd.py.

445  def getSchemaCatalogs(self):
446  """The schema catalogs that will be used by this task.
447 
448  Returns
449  -------
450  schemaCatalogs : `dict`
451  Dictionary mapping dataset type to schema catalog.
452 
453  Notes
454  -----
455  There is only one schema for each type of forced measurement. The
456  dataset type for this measurement is defined in the mapper.
457  """
458  catalog = lsst.afw.table.SourceCatalog(self.measurement.schema)
459  catalog.getTable().setMetadata(self.measurement.algMetadata)
460  datasetType = self.dataPrefix + "forced_src"
461  return {datasetType: catalog}
462 

◆ writeOutput()

def lsst.meas.base.forcedPhotCoadd.writeOutput (   self,
  dataRef,
  sources 
)
Write forced source table

Parameters
----------
dataRef : `lsst.daf.persistence.ButlerDataRef`
    Butler data reference. The forced_src dataset (with
    self.dataPrefix prepended) is all that will be modified.
sources : `lsst.afw.table.SourceCatalog`
    Catalog of sources to save.

Definition at line 432 of file forcedPhotCoadd.py.

432  def writeOutput(self, dataRef, sources):
433  """Write forced source table
434 
435  Parameters
436  ----------
437  dataRef : `lsst.daf.persistence.ButlerDataRef`
438  Butler data reference. The forced_src dataset (with
439  self.dataPrefix prepended) is all that will be modified.
440  sources : `lsst.afw.table.SourceCatalog`
441  Catalog of sources to save.
442  """
443  dataRef.put(sources, self.dataPrefix + "forced_src", flags=lsst.afw.table.SOURCE_IO_NO_FOOTPRINTS)
444 
def writeOutput(self, dataRef, sources)

Variable Documentation

◆ exposureIdInfo

lsst.meas.base.forcedPhotCoadd.exposureIdInfo
Initial value:
1 = ExposureIdInfo(int(dataRef.get(self.config.coaddName + "CoaddId")),
2  dataRef.get(self.config.coaddName + "CoaddId_bits"))

Definition at line 357 of file forcedPhotCoadd.py.

◆ removePatchOverlaps

lsst.meas.base.forcedPhotCoadd.removePatchOverlaps

Definition at line 153 of file forcedPhotCoadd.py.