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 | Static Public Attributes | Private Member Functions | Static Private Attributes | List of all members
lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask Class Reference

A command-line driver for performing forced measurement on CCD images. More...

Inheritance diagram for lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask:

Public Member Functions

def makeIdFactory
 
def fetchReferences
 
def getExposure
 

Static Public Attributes

 ConfigClass = ForcedPhotCcdConfig
 
 RunnerClass = lsst.pipe.base.ButlerInitializedTaskRunner
 
string dataPrefix = ""
 

Private Member Functions

def _getConfigName
 Return the name of the config dataset. More...
 
def _getMetadataName
 Return the name of the metadata dataset. More...
 
def _makeArgumentParser
 

Static Private Attributes

string _DefaultName = "forcedPhotCcd"
 

Detailed Description

A command-line driver for performing forced measurement on CCD images.

This task is a subclass of ForcedPhotImageTask which is specifically for doing forced measurement on a single CCD exposure, using as a reference catalog the detections which were made on overlapping coadds.

The run method (inherited from ForcedPhotImageTask) takes a lsst.daf.persistence.ButlerDataRef argument that corresponds to a single CCD. This should contain the data ID keys that correspond to the "forced_src" dataset (the output dataset for ForcedPhotCcdTask), which are typically all those used to specify the "calexp" dataset (e.g. visit, raft, sensor for LSST data) as well as a coadd tract. The tract is used to look up the appropriate coadd measurement catalogs to use as references (e.g. deepCoadd_src; see CoaddSrcReferencesTask for more information). While the tract must be given as part of the dataRef, the patches are determined automatically from the bounding box and WCS of the calexp to be measured, and the filter used to fetch references is set via config (BaseReferencesConfig.filter).

In addition to the run method, ForcedPhotCcdTask overrides several methods of ForcedPhotImageTask to specialize it for single-CCD processing, including makeIdFactory(), fetchReferences(), and getExposure(). None of these should be called directly by the user, though it may be useful to override them further in subclasses.

Definition at line 81 of file forcedPhotCcd.py.

Member Function Documentation

def lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask._getConfigName (   self)
private

Return the name of the config dataset.

Forces config comparison from run-to-run

Definition at line 171 of file forcedPhotCcd.py.

172  def _getConfigName(self):
173  """!Return the name of the config dataset. Forces config comparison from run-to-run
174  """
175  return self.dataPrefix + "forcedPhotCcd_config"
def _getConfigName
Return the name of the config dataset.
def lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask._getMetadataName (   self)
private

Return the name of the metadata dataset.

Forced metadata to be saved

Definition at line 176 of file forcedPhotCcd.py.

177  def _getMetadataName(self):
178  """!Return the name of the metadata dataset. Forced metadata to be saved
179  """
180  return self.dataPrefix + "forcedPhotCcd_metadata"
def _getMetadataName
Return the name of the metadata dataset.
def lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask._makeArgumentParser (   cls)
private

Definition at line 182 of file forcedPhotCcd.py.

183  def _makeArgumentParser(cls):
184  parser = lsst.pipe.base.ArgumentParser(name=cls._DefaultName)
185  parser.add_id_argument("--id", "forced_src", help="data ID, with raw CCD keys + tract",
186  ContainerClass=ForcedPhotCcdDataIdContainer)
187  return parser
188 
189 
def lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask.fetchReferences (   self,
  dataRef,
  exposure 
)
Return a SourceCatalog of sources which overlap the exposure.

The returned catalog is sorted by ID and guarantees that all included children have their
parent included and that all Footprints are valid.

@param dataRef       Data reference from butler corresponding to the image to be measured;
             should have tract, patch, and filter keys.
@param exposure      lsst.afw.image.Exposure to be measured (used only to obtain a Wcs and
             bounding box).

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

Definition at line 122 of file forcedPhotCcd.py.

123  def fetchReferences(self, dataRef, exposure):
124  """Return a SourceCatalog of sources which overlap the exposure.
125 
126  The returned catalog is sorted by ID and guarantees that all included children have their
127  parent included and that all Footprints are valid.
128 
129  @param dataRef Data reference from butler corresponding to the image to be measured;
130  should have tract, patch, and filter keys.
131  @param exposure lsst.afw.image.Exposure to be measured (used only to obtain a Wcs and
132  bounding box).
133 
134  All work is delegated to the references subtask; see CoaddSrcReferencesTask for information
135  about the default behavior.
136  """
137  references = lsst.afw.table.SourceCatalog(self.references.schema)
138  badParents = set()
139  unfiltered = self.references.fetchInBox(dataRef, exposure.getBBox(), exposure.getWcs())
140  for record in unfiltered:
141  if record.getFootprint() is None or record.getFootprint().getArea() == 0:
142  if record.getParent() != 0:
143  self.log.warn("Skipping reference %s (child of %s) with bad Footprint" %
144  (record.getId(), record.getParent()))
145  else:
146  self.log.warn("Skipping reference parent %s with bad Footprint" % (record.getId(),))
147  badParents.add(record.getId())
148  elif record.getParent() not in badParents:
149  references.append(record)
150  references.sort() # need to ensure catalog is in ID order so find methods work
151  return references
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:55
def lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask.getExposure (   self,
  dataRef 
)
Read input exposure to measure

@param dataRef       Data reference from butler.  Only the 'calexp' dataset is used,
             unless config.doApplyUberCal is true, in which case the corresponding
             meas_mosaic outputs are used as well.

Definition at line 152 of file forcedPhotCcd.py.

153  def getExposure(self, dataRef):
154  """Read input exposure to measure
155 
156  @param dataRef Data reference from butler. Only the 'calexp' dataset is used,
157  unless config.doApplyUberCal is true, in which case the corresponding
158  meas_mosaic outputs are used as well.
159  """
160  exposure = ProcessImageForcedTask.getExposure(self, dataRef)
161  if not self.config.doApplyUberCal:
162  return exposure
163  if applyMosaicResults is None:
164  raise RuntimeError(
165  "Cannot use improved calibrations for %s because meas_mosaic could not be imported."
166  % dataRef.dataId
167  )
168  else:
169  applyMosaicResults(dataRef, calexp=exposure)
170  return exposure
def lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask.makeIdFactory (   self,
  dataRef 
)
Create an object that generates globally unique source IDs from per-CCD IDs and the CCD ID.

@param dataRef       Data reference from butler.  The "ccdExposureId_bits" and "ccdExposureId"
             datasets are accessed.  The data ID must have the keys that correspond
             to ccdExposureId, which is generally the same that correspond to "calexp"
             (e.g. visit, raft, sensor for LSST data).

Definition at line 110 of file forcedPhotCcd.py.

111  def makeIdFactory(self, dataRef):
112  """Create an object that generates globally unique source IDs from per-CCD IDs and the CCD ID.
113 
114  @param dataRef Data reference from butler. The "ccdExposureId_bits" and "ccdExposureId"
115  datasets are accessed. The data ID must have the keys that correspond
116  to ccdExposureId, which is generally the same that correspond to "calexp"
117  (e.g. visit, raft, sensor for LSST data).
118  """
119  expBits = dataRef.get("ccdExposureId_bits")
120  expId = long(dataRef.get("ccdExposureId"))
121  return lsst.afw.table.IdFactory.makeSource(expId, 64 - expBits)
static boost::shared_ptr< IdFactory > makeSource(RecordId expId, int reserved)
Return an IdFactory that includes another, fixed ID in the higher-order bits.

Member Data Documentation

string lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask._DefaultName = "forcedPhotCcd"
staticprivate

Definition at line 107 of file forcedPhotCcd.py.

lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask.ConfigClass = ForcedPhotCcdConfig
static

Definition at line 105 of file forcedPhotCcd.py.

string lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask.dataPrefix = ""
static

Definition at line 108 of file forcedPhotCcd.py.

lsst.meas.base.forcedPhotCcd.ForcedPhotCcdTask.RunnerClass = lsst.pipe.base.ButlerInitializedTaskRunner
static

Definition at line 106 of file forcedPhotCcd.py.


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