lsst.pipe.tasks  21.0.0-20-g55224fe4+fb58a89680
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pipe.tasks.characterizeImage.CharacterizeImageTask Class Reference

Measure bright sources and use this to estimate background and PSF of an exposure. More...

Inheritance diagram for lsst.pipe.tasks.characterizeImage.CharacterizeImageTask:

Public Member Functions

def runQuantum (self, butlerQC, inputRefs, outputRefs)
 
def __init__ (self, butler=None, refObjLoader=None, schema=None, **kwargs)
 Construct a CharacterizeImageTask. More...
 
def getInitOutputDatasets (self)
 
def runDataRef (self, dataRef, exposure=None, background=None, doUnpersist=True)
 Characterize a science image and, if wanted, persist the results. More...
 
def run (self, exposure, exposureIdInfo=None, background=None)
 Characterize a science image. More...
 
def detectMeasureAndEstimatePsf (self, exposure, exposureIdInfo, background)
 Perform one iteration of detect, measure and estimate PSF. More...
 
def getSchemaCatalogs (self)
 
def display (self, itemName, exposure, sourceCat=None)
 

Public Attributes

 schema
 
 algMetadata
 
 outputSchema
 

Static Public Attributes

 ConfigClass
 
 RunnerClass
 

Detailed Description

Measure bright sources and use this to estimate background and PSF of an exposure.

Contents

Description

Given an exposure with defects repaired (masked and interpolated over, e.g. as output by IsrTask):

Task initialisation

Construct a CharacterizeImageTask.

Parameters
[in]butlerA butler object is passed to the refObjLoader constructor in case it is needed to load catalogs. May be None if a catalog-based star selector is not used, if the reference object loader constructor does not require a butler, or if a reference object loader is passed directly via the refObjLoader argument.
[in]refObjLoaderAn instance of LoadReferenceObjectsTasks that supplies an external reference catalog to a catalog-based star selector. May be None if a catalog star selector is not used or the loader can be constructed from the butler argument.
[in,out]schemainitial schema (an lsst.afw.table.SourceTable), or None
[in,out]kwargsother keyword arguments for lsst.pipe.base.CmdLineTask

Invoking the Task

If you want this task to unpersist inputs or persist outputs, then call the runDataRef method (a thin wrapper around the run method).

If you already have the inputs unpersisted and do not want to persist the output then it is more direct to call the run method:

Configuration parameters

See CharacterizeImageConfig

Debug variables

The command line task interface supports a flag --debug to import debug.py from your $PYTHONPATH; see Using lsstDebug to control debugging output for more about debug.py.

CharacterizeImageTask has a debug dictionary with the following keys:

frame
int: if specified, the frame of first debug image displayed (defaults to 1)
repair_iter
bool; if True display image after each repair in the measure PSF loop
background_iter
bool; if True display image after each background subtraction in the measure PSF loop
measure_iter
bool; if True display image and sources at the end of each iteration of the measure PSF loop See lsst::meas::astrom::displayAstrometry for the meaning of the various symbols.
psf
bool; if True display image and sources after PSF is measured; this will be identical to the final image displayed by measure_iter if measure_iter is true
repair
bool; if True display image and sources after final repair
measure
bool; if True display image and sources after final measurement

For example, put something like:

import lsstDebug
def DebugInfo(name):
di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively
if name == "lsst.pipe.tasks.characterizeImage":
di.display = dict(
repair = True,
)
return di
lsstDebug.Info = DebugInfo

into your debug.py file and run calibrateTask.py with the --debug flag.

Some subtasks may have their own debug variables; see individual Task documentation.

Definition at line 236 of file characterizeImage.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.__init__ (   self,
  butler = None,
  refObjLoader = None,
  schema = None,
**  kwargs 
)

Construct a CharacterizeImageTask.

Parameters
[in]butlerA butler object is passed to the refObjLoader constructor in case it is needed to load catalogs. May be None if a catalog-based star selector is not used, if the reference object loader constructor does not require a butler, or if a reference object loader is passed directly via the refObjLoader argument.
[in]refObjLoaderAn instance of LoadReferenceObjectsTasks that supplies an external reference catalog to a catalog-based star selector. May be None if a catalog star selector is not used or the loader can be constructed from the butler argument.
[in,out]schemainitial schema (an lsst.afw.table.SourceTable), or None
[in,out]kwargsother keyword arguments for lsst.pipe.base.CmdLineTask

Definition at line 334 of file characterizeImage.py.

Member Function Documentation

◆ detectMeasureAndEstimatePsf()

def lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.detectMeasureAndEstimatePsf (   self,
  exposure,
  exposureIdInfo,
  background 
)

Perform one iteration of detect, measure and estimate PSF.

Performs the following operations:

  • if config.doMeasurePsf or not exposure.hasPsf():
    • install a simple PSF model (replacing the existing one, if need be)
  • interpolate over cosmic rays with keepCRs=True
  • estimate background and subtract it from the exposure
  • detect, deblend and measure sources, and subtract a refined background model;
  • if config.doMeasurePsf:
    • measure PSF
Parameters
[in,out]exposureexposure to characterize (an lsst.afw.image.ExposureF or similar) The following changes are made:
  • update or set psf
  • update detection and cosmic ray mask planes
  • subtract background
[in]exposureIdInfoID info for exposure (an lsst.obs_base.ExposureIdInfo)
[in,out]backgroundinitial model of background already subtracted from exposure (an lsst.afw.math.BackgroundList).
Returns
pipe_base Struct containing these fields, all from the final iteration of detect sources, measure sources and estimate PSF:
  • exposure characterized exposure; image is repaired by interpolating over cosmic rays, mask is updated accordingly, and the PSF model is set
  • sourceCat detected sources (an lsst.afw.table.SourceCatalog)
  • background model of background subtracted from exposure (an lsst.afw.math.BackgroundList)
  • psfCellSet spatial cells of PSF candidates (an lsst.afw.math.SpatialCellSet)

Definition at line 519 of file characterizeImage.py.

◆ display()

def lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.display (   self,
  itemName,
  exposure,
  sourceCat = None 
)
Display exposure and sources on next frame, if display of itemName has been requested

@param[in] itemName  name of item in debugInfo
@param[in] exposure  exposure to display
@param[in] sourceCat  source catalog to display

Definition at line 607 of file characterizeImage.py.

◆ getInitOutputDatasets()

def lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.getInitOutputDatasets (   self)

Definition at line 376 of file characterizeImage.py.

◆ getSchemaCatalogs()

def lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.getSchemaCatalogs (   self)
Return a dict of empty catalogs for each catalog dataset produced by this task.

Definition at line 600 of file characterizeImage.py.

◆ run()

def lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.run (   self,
  exposure,
  exposureIdInfo = None,
  background = None 
)

Characterize a science image.

Peforms the following operations:

  • Iterate the following config.psfIterations times, or once if config.doMeasurePsf false:
    • detect and measure sources and estimate PSF (see detectMeasureAndEstimatePsf for details)
  • interpolate over cosmic rays
  • perform final measurement
Parameters
[in,out]exposureexposure to characterize (an lsst.afw.image.ExposureF or similar). The following changes are made:
  • update or set psf
  • set apCorrMap
  • update detection and cosmic ray mask planes
  • subtract background and interpolate over cosmic rays
[in]exposureIdInfoID info for exposure (an lsst.obs.base.ExposureIdInfo). If not provided, returned SourceCatalog IDs will not be globally unique.
[in,out]backgroundinitial model of background already subtracted from exposure (an lsst.afw.math.BackgroundList). May be None if no background has been subtracted, which is typical for image characterization.
Returns
pipe_base Struct containing these fields, all from the final iteration of detectMeasureAndEstimatePsf:
  • exposure: characterized exposure; image is repaired by interpolating over cosmic rays, mask is updated accordingly, and the PSF model is set
  • sourceCat: detected sources (an lsst.afw.table.SourceCatalog)
  • background: model of background subtracted from exposure (an lsst.afw.math.BackgroundList)
  • psfCellSet: spatial cells of PSF candidates (an lsst.afw.math.SpatialCellSet)

Definition at line 434 of file characterizeImage.py.

◆ runDataRef()

def lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.runDataRef (   self,
  dataRef,
  exposure = None,
  background = None,
  doUnpersist = True 
)

Characterize a science image and, if wanted, persist the results.

This simply unpacks the exposure and passes it to the characterize method to do the work.

Parameters
[in]dataRefbutler data reference for science exposure
[in,out]exposureexposure to characterize (an lsst.afw.image.ExposureF or similar). If None then unpersist from "postISRCCD". The following changes are made, depending on the config:
  • set psf to the measured PSF
  • set apCorrMap to the measured aperture correction
  • subtract background
  • interpolate over cosmic rays
  • update detection and cosmic ray mask planes
[in,out]backgroundinitial model of background already subtracted from exposure (an lsst.afw.math.BackgroundList). May be None if no background has been subtracted, which is typical for image characterization. A refined background model is output.
[in]doUnpersistif True the exposure is read from the repository and the exposure and background arguments must be None; if False the exposure must be provided. True is intended for running as a command-line task, False for running as a subtask
Returns
same data as the characterize method

Definition at line 382 of file characterizeImage.py.

◆ runQuantum()

def lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.runQuantum (   self,
  butlerQC,
  inputRefs,
  outputRefs 
)

Definition at line 324 of file characterizeImage.py.

Member Data Documentation

◆ algMetadata

lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.algMetadata

Definition at line 362 of file characterizeImage.py.

◆ ConfigClass

lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.ConfigClass
static

Definition at line 320 of file characterizeImage.py.

◆ outputSchema

lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.outputSchema

Definition at line 374 of file characterizeImage.py.

◆ RunnerClass

lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.RunnerClass
static

Definition at line 322 of file characterizeImage.py.

◆ schema

lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.schema

Definition at line 352 of file characterizeImage.py.


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