lsst.pipe.tasks ge54c72f270+6dd0a2cf65
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 142 of file matchBackgrounds.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 146 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.

Parameters
----------
refExposure : `lsst.afw.image.Exposure`
    Reference exposure.
sciExposure : `lsst.afw.image.Exposure`
    Science exposure; modified by changing the background level
    to match that of the reference exposure.

Returns
-------
model : `lsst.pipe.base.Struct`
    Background model as a struct with attributes:

    ``backgroundModel``
        An afw.math.Approximate or an afw.math.Background.
    ``fitRMS``
        RMS of the fit. This is the sqrt(mean(residuals**2)), (`float`).
    ``matchedMSE``
        The MSE of the reference and matched images: mean((refImage - matchedSciImage)**2);
        should be comparable to difference image's mean variance (`float`).
    ``diffImVar``
        The mean variance of the difference image (`float`).

Definition at line 363 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.

Parameters
----------
expRefList : `list`
    List of data references to science exposures to be background-matched;
    all exposures must exist.
expDatasetType : `str`
    Dataset type of exposures, e.g. 'goodSeeingCoadd_tempExp'.
imageScalerList : `list`, optional
    List of image scalers (coaddUtils.ImageScaler);
    if None then the images are not scaled.
refExpDataRef : `Unknown`, optional
    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.
refImageScaler : `Unknown`, optional
    Image scaler for reference image;
    ignored if refExpDataRef is None, else scaling is not performed if None.

Returns
-------
result : `lsst.pipe.base.Struct`
    Results as a struct with attributes:

    ``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``: The 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.

Raises
------
RuntimeError
    Raised if an exposure does not exist on disk.

Definition at line 154 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

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

Returns
-------
bestIdx : `int`
    Index of best exposure.

Raises
------
RuntimeError
    Raised if none of the exposures in expRefList are found.

Definition at line 288 of file matchBackgrounds.py.

Member Data Documentation

◆ ConfigClass

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

Definition at line 143 of file matchBackgrounds.py.

◆ debugDataIdString

lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask.debugDataIdString

Definition at line 266 of file matchBackgrounds.py.

◆ sctrl

lsst.pipe.tasks.matchBackgrounds.MatchBackgroundsTask.sctrl

Definition at line 149 of file matchBackgrounds.py.


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