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.forcedPhotImage.ProcessImageForcedTask Class Reference

A base class for command-line forced measurement drivers. More...

Inheritance diagram for lsst.meas.base.forcedPhotImage.ProcessImageForcedTask:

Public Member Functions

def __init__
 
def run
 Measure a single exposure using forced detection for a reference catalog. More...
 
def makeIdFactory
 Hook for derived classes to define how to make an IdFactory for forced sources. More...
 
def fetchReferences
 Hook for derived classes to define how to get references objects. More...
 
def attachFootprints
 Hook for derived classes to define how to attach Footprints to blank sources prior to measurement. More...
 
def getExposure
 Read input exposure on which to perform the measurements. More...
 
def writeOutput
 Write forced source table. More...
 
def getSchemaCatalogs
 Get a dict of Schema catalogs that will be used by this Task. More...
 

Static Public Attributes

 ConfigClass = ProcessImageForcedConfig
 

Private Member Functions

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

Static Private Attributes

string _DefaultName = "processImageForcedTask"
 

Detailed Description

A base class for command-line forced measurement drivers.

This is a an abstract class, which is the common ancestor for ForcedPhotCcdTask and ForcedPhotCoaddTask. It provides the run() method that does most of the work, while delegating a few customization tasks to other methods that are overridden by subclasses.

This task is not directly usable as a CmdLineTask; subclasses must:

Definition at line 71 of file forcedPhotImage.py.

Constructor & Destructor Documentation

def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask.__init__ (   self,
  butler = None,
  refSchema = None,
  kwds 
)
Initialize the task.

ForcedPhotImageTask takes two keyword arguments beyond the usual CmdLineTask arguments:
 - refSchema: the Schema of the reference catalog, passed to the constructor of the references
   subtask
 - butler: a butler that will be passed to the references subtask to allow it to load its Schema
   from disk
At least one of these arguments must be present; if both are, schema takes precedence.

Definition at line 88 of file forcedPhotImage.py.

88 
89  def __init__(self, butler=None, refSchema=None, **kwds):
90  """Initialize the task.
91 
92  ForcedPhotImageTask takes two keyword arguments beyond the usual CmdLineTask arguments:
93  - refSchema: the Schema of the reference catalog, passed to the constructor of the references
94  subtask
95  - butler: a butler that will be passed to the references subtask to allow it to load its Schema
96  from disk
97  At least one of these arguments must be present; if both are, schema takes precedence.
98  """
99  super(lsst.pipe.base.CmdLineTask, self).__init__(**kwds)
100  self.makeSubtask("references", butler=butler, schema=refSchema)
101  if refSchema is None:
102  refSchema = self.references.schema
103  self.makeSubtask("measurement", refSchema=refSchema)

Member Function Documentation

def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask._getConfigName (   self)
private

Return the name of the config dataset.

Forces config comparison from run-to-run

Definition at line 190 of file forcedPhotImage.py.

191  def _getConfigName(self):
192  """!Return the name of the config dataset. Forces config comparison from run-to-run
193  """
194  return self.dataPrefix + "forced_config"
def _getConfigName
Return the name of the config dataset.
def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask._getMetadataName (   self)
private

Return the name of the metadata dataset.

Forced metadata to be saved

Definition at line 195 of file forcedPhotImage.py.

196  def _getMetadataName(self):
197  """!Return the name of the metadata dataset. Forced metadata to be saved
198  """
199  return self.dataPrefix + "forced_metadata"
200 
def _getMetadataName
Return the name of the metadata dataset.
def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask.attachFootprints (   self,
  sources,
  refCat,
  exposure,
  refWcs,
  dataRef 
)

Hook for derived classes to define how to attach Footprints to blank sources prior to measurement.

Footprints for forced photometry must be in the pixel coordinate system of the image being measured, while the actual detections may start out in a different coordinate system.

Subclasses for ForcedPhotImageTask must implement this method to define how those Footprints should be generated.

The default implementation (defined in forcedMeasurement.py) transforms the Footprints from the reference catalog from the refWcs to the exposure's Wcs, which downgrades HeavyFootprints into regular Footprints, destroying deblend information.

Definition at line 148 of file forcedPhotImage.py.

149  def attachFootprints(self, sources, refCat, exposure, refWcs, dataRef):
150  """!Hook for derived classes to define how to attach Footprints to blank sources prior to measurement
151 
152  Footprints for forced photometry must be in the pixel coordinate system of the image being
153  measured, while the actual detections may start out in a different coordinate system.
154 
155  Subclasses for ForcedPhotImageTask must implement this method to define how those Footprints
156  should be generated.
157 
158  The default implementation (defined in forcedMeasurement.py) transforms the Footprints from
159  the reference catalog from the refWcs to the exposure's Wcs, which downgrades HeavyFootprints
160  into regular Footprints, destroying deblend information.
161  """
162  return self.measurement.attachTransformedFootprints(sources, refCat, exposure, refWcs)
def attachFootprints
Hook for derived classes to define how to attach Footprints to blank sources prior to measurement...
def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask.fetchReferences (   self,
  dataRef,
  exposure 
)

Hook for derived classes to define how to get references objects.

Derived classes should call one of the fetch* methods on the references subtask, but which one they call depends on whether the region to get references for is a easy to describe in patches (as it would be when doing forced measurements on a coadd), or is just an arbitrary box (as it would be for CCD forced measurements).

Definition at line 138 of file forcedPhotImage.py.

139  def fetchReferences(self, dataRef, exposure):
140  """!Hook for derived classes to define how to get references objects.
141 
142  Derived classes should call one of the fetch* methods on the references subtask,
143  but which one they call depends on whether the region to get references for is a
144  easy to describe in patches (as it would be when doing forced measurements on a
145  coadd), or is just an arbitrary box (as it would be for CCD forced measurements).
146  """
147  raise NotImplementedError()
def fetchReferences
Hook for derived classes to define how to get references objects.
def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask.getExposure (   self,
  dataRef 
)

Read input exposure on which to perform the measurements.

Parameters
dataRefData reference from butler.

Definition at line 163 of file forcedPhotImage.py.

164  def getExposure(self, dataRef):
165  """!Read input exposure on which to perform the measurements
166 
167  @param dataRef Data reference from butler.
168  """
169  return dataRef.get(self.dataPrefix + "calexp", immediate=True)
def getExposure
Read input exposure on which to perform the measurements.
def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask.getSchemaCatalogs (   self)

Get a dict of Schema catalogs that will be used by this Task.

In the case of forced taks, 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 179 of file forcedPhotImage.py.

180  def getSchemaCatalogs(self):
181  """!Get a dict of Schema catalogs that will be used by this Task.
182 
183  In the case of forced taks, there is only one schema for each type of forced measurement.
184  The dataset type for this measurement is defined in the mapper.
185  """
186  catalog = lsst.afw.table.SourceCatalog(self.measurement.mapper.getOutputSchema())
187  catalog.getTable().setMetadata(self.measurement.algMetadata)
188  datasetType = self.dataPrefix + "forced_src"
189  return {datasetType:catalog}
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 getSchemaCatalogs
Get a dict of Schema catalogs that will be used by this Task.
def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask.makeIdFactory (   self,
  dataRef 
)

Hook for derived classes to define how to make an IdFactory for forced sources.

Note that this is for forced source IDs, not object IDs, which are usually handled by the copyColumns config option.

Definition at line 130 of file forcedPhotImage.py.

131  def makeIdFactory(self, dataRef):
132  """!Hook for derived classes to define how to make an IdFactory for forced sources.
133 
134  Note that this is for forced source IDs, not object IDs, which are usually handled by
135  the copyColumns config option.
136  """
137  raise NotImplementedError()
def makeIdFactory
Hook for derived classes to define how to make an IdFactory for forced sources.
def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask.run (   self,
  dataRef 
)

Measure a single exposure using forced detection for a reference catalog.

Parameters
[in]dataRefAn lsst.daf.persistence.ButlerDataRef. It is passed to the references subtask to obtain the reference WCS, the getExposure() method (implemented by derived classes) to read the measurement image, and the fetchReferences() method (implemented by derived classes) to get the exposure and load the reference catalog (see the CoaddSrcReferencesTask for more information). Sources are generated with generateMeasCat() in the measurement subtask. These are passed to measurement's run method which fills the source catalog with the forced measurement results. The sources are then passed to the writeOutputs() method (implemented by derived classes) which writes the outputs. See derived class documentation for which datasets and data ID keys are used.

Definition at line 104 of file forcedPhotImage.py.

105  def run(self, dataRef):
106  """!Measure a single exposure using forced detection for a reference catalog.
107 
108  @param[in] dataRef An lsst.daf.persistence.ButlerDataRef. It is passed to the
109  references subtask to obtain the reference WCS, the getExposure()
110  method (implemented by derived classes) to read the measurement
111  image, and the fetchReferences() method (implemented by derived
112  classes) to get the exposure and load the reference catalog (see
113  the CoaddSrcReferencesTask for more information). Sources are
114  generated with generateMeasCat() in the measurement subtask. These
115  are passed to measurement's run method which fills the source
116  catalog with the forced measurement results. The sources are then
117  passed to the writeOutputs() method (implemented by derived classes)
118  which writes the outputs. See derived class documentation for which
119  datasets and data ID keys are used.
120  """
121  refWcs = self.references.getWcs(dataRef)
122  exposure = self.getExposure(dataRef)
123  refCat = self.fetchReferences(dataRef, exposure)
124  measCat = self.measurement.generateMeasCat(exposure, refCat, refWcs,
125  idFactory=self.makeIdFactory(dataRef))
126  self.log.info("Performing forced measurement on %s" % dataRef.dataId)
127  self.attachFootprints(measCat, refCat, exposure, refWcs, dataRef)
128  self.measurement.run(measCat, exposure, refCat, refWcs)
129  self.writeOutput(dataRef, measCat)
def fetchReferences
Hook for derived classes to define how to get references objects.
def attachFootprints
Hook for derived classes to define how to attach Footprints to blank sources prior to measurement...
def run
Measure a single exposure using forced detection for a reference catalog.
def getExposure
Read input exposure on which to perform the measurements.
def makeIdFactory
Hook for derived classes to define how to make an IdFactory for forced sources.
def lsst.meas.base.forcedPhotImage.ProcessImageForcedTask.writeOutput (   self,
  dataRef,
  sources 
)

Write forced source table.

Parameters
dataRefData reference from butler; the forced_src dataset (with self.dataPrefix included) is all that will be modified.
sourcesSourceCatalog to save

Definition at line 170 of file forcedPhotImage.py.

171  def writeOutput(self, dataRef, sources):
172  """!Write forced source table
173 
174  @param dataRef Data reference from butler; the forced_src dataset (with self.dataPrefix included)
175  is all that will be modified.
176  @param sources SourceCatalog to save
177  """
178  dataRef.put(sources, self.dataPrefix + "forced_src")

Member Data Documentation

string lsst.meas.base.forcedPhotImage.ProcessImageForcedTask._DefaultName = "processImageForcedTask"
staticprivate

Definition at line 86 of file forcedPhotImage.py.

lsst.meas.base.forcedPhotImage.ProcessImageForcedTask.ConfigClass = ProcessImageForcedConfig
static

Definition at line 85 of file forcedPhotImage.py.


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