lsst.pipe.tasks  21.0.0-119-g1a9a5132+d29897724a
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask Class Reference
Inheritance diagram for lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask:

Public Member Functions

def __init__ (self, *args, **kwargs)
 
def run (self, expRefList, expDatasetType, imageScalerList=None, refExpDataRef=None, refImageScaler=None)
 
def selectRefExposure (self, expRefList, imageScalerList, expDatasetType)
 
def matchBackgrounds (self, refExposure, sciExposure)
 

Public Attributes

 sctrl
 
 debugDataIdString
 

Static Public Attributes

 ConfigClass = MatchBackgroundsConfig
 

Detailed Description

Definition at line 138 of file matchBackgrounds.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask.__init__ (   self,
args,
**  kwargs 
)

Definition at line 142 of file matchBackgrounds.py.

Member Function Documentation

◆ matchBackgrounds()

def lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask.matchBackgrounds (   self,
  refExposure,
  sciExposure 
)
Match science exposure's background level to that of reference exposure.

Process creates a difference image of the reference exposure minus the science exposure, and then
generates an afw.math.Background object. It assumes (but does not require/check) that the mask plane
already has detections set. If detections have not been set/masked, sources will bias the
background estimation.
The 'background' of the difference image is smoothed by spline interpolation (by the Background class)
or by polynomial interpolation by the Approximate class. This model of difference image
is added to the science exposure in memory.
Fit diagnostics are also calculated and returned.

@param[in] refExposure: reference exposure
@param[in,out] sciExposure: science exposure; modified by changing the background level
    to match that of the reference exposure
@returns a pipBase.Struct with fields:
    - backgroundModel: an afw.math.Approximate or an afw.math.Background.
    - fitRMS: rms of the fit. This is the sqrt(mean(residuals**2)).
    - matchedMSE: the MSE of the reference and matched images: mean((refImage - matchedSciImage)**2);
      should be comparable to difference image's mean variance.
    - diffImVar: the mean variance of the difference image.

Definition at line 331 of file matchBackgrounds.py.

◆ run()

def lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask.run (   self,
  expRefList,
  expDatasetType,
  imageScalerList = None,
  refExpDataRef = None,
  refImageScaler = None 
)
Match the backgrounds of a list of coadd temp exposures to a reference coadd temp exposure.

Choose a refExpDataRef automatically if none supplied.

@param[in] expRefList: list of data references to science exposures to be background-matched;
    all exposures must exist.
@param[in] expDatasetType: dataset type of exposures, e.g. 'goodSeeingCoadd_tempExp'
@param[in] imageScalerList: list of image scalers (coaddUtils.ImageScaler);
    if None then the images are not scaled
@param[in] refExpDataRef: data reference for the reference exposure.
    If None, then this task selects the best exposures from expRefList.
    if not None then must be one of the exposures in expRefList.
@param[in] refImageScaler: image scaler for reference image;
    ignored if refExpDataRef is None, else scaling is not performed if None

@return: a pipBase.Struct containing these fields:
- backgroundInfoList: a list of pipeBase.Struct, one per exposure in expRefList,
    each of which contains these fields:
    - isReference: this is the reference exposure (only one returned Struct will
        contain True for this value, unless the ref exposure is listed multiple times)
    - backgroundModel: differential background model (afw.Math.Background or afw.Math.Approximate).
        Add this to the science exposure to match the reference exposure.
    - fitRMS: rms of the fit. This is the sqrt(mean(residuals**2)).
    - matchedMSE: the MSE of the reference and matched images: mean((refImage - matchedSciImage)**2);
      should be comparable to difference image's mean variance.
    - diffImVar: the mean variance of the difference image.
    All fields except isReference will be None if isReference True or the fit failed.

@warning: all exposures must exist on disk

Definition at line 150 of file matchBackgrounds.py.

◆ selectRefExposure()

def lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask.selectRefExposure (   self,
  expRefList,
  imageScalerList,
  expDatasetType 
)
Find best exposure to use as the reference exposure

Calculate an appropriate reference exposure by minimizing a cost function that penalizes
high variance,  high background level, and low coverage. Use the following config parameters:
- bestRefWeightCoverage
- bestRefWeightVariance
- bestRefWeightLevel

@param[in] expRefList: list of data references to exposures.
    Retrieves dataset type specified by expDatasetType.
    If an exposure is not found, it is skipped with a warning.
@param[in] imageScalerList: list of image scalers (coaddUtils.ImageScaler);
    must be the same length as expRefList
@param[in] expDatasetType: dataset type of exposure: e.g. 'goodSeeingCoadd_tempExp'

@return: index of best exposure

@raise pipeBase.TaskError if none of the exposures in expRefList are found.

Definition at line 267 of file matchBackgrounds.py.

Member Data Documentation

◆ ConfigClass

lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask.ConfigClass = MatchBackgroundsConfig
static

Definition at line 139 of file matchBackgrounds.py.

◆ debugDataIdString

lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask.debugDataIdString

Definition at line 245 of file matchBackgrounds.py.

◆ sctrl

lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask.sctrl

Definition at line 145 of file matchBackgrounds.py.


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