lsst.pipe.tasks g540474b770+e2881a99e2
Loading...
Searching...
No Matches
lsst.pipe.tasks.skyCorrection.SkyCorrectionTask Class Reference
Inheritance diagram for lsst.pipe.tasks.skyCorrection.SkyCorrectionTask:

Public Member Functions

 __init__ (self, *args, **kwargs)
 
 runQuantum (self, butlerQC, inputRefs, outputRefs)
 
 run (self, calExps, calBkgs, skyFrames, camera, backgroundToPhotometricRatioHandles=[])
 

Static Public Attributes

 ConfigClass = SkyCorrectionConfig
 

Protected Member Functions

 _getCalExp (self, calExpHandle, mask=None, skyCorr=None, backgroundToPhotometricRatioHandle=None)
 
 _getSkyFrame (self, skyFrameHandle)
 
 _restoreOriginalBackgroundRefineMask (self, calExp, calBkg)
 
 _validateBgModel (self, bgModelID, bgModel, config)
 
 _fitSkyFrame (self, calExps, masks, skyCorrs, skyFrames, backgroundToPhotometricRatioHandles)
 

Static Protected Attributes

str _DefaultName = "skyCorr"
 

Detailed Description

Perform a full focal plane sky correction.

Definition at line 214 of file skyCorrection.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask.__init__ ( self,
* args,
** kwargs )

Definition at line 220 of file skyCorrection.py.

Member Function Documentation

◆ _fitSkyFrame()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._fitSkyFrame ( self,
calExps,
masks,
skyCorrs,
skyFrames,
backgroundToPhotometricRatioHandles )
protected
Determine the full focal plane sky frame scale factor relative to
an input list of calibrated exposures.

This method measures the sky frame scale on all inputs, resulting in
values equal to the background method solveScales().

Input skyCorrs are updated in-place.

Parameters
----------
calExps : `list` [`lsst.afw.image.ExposureF`]
    Calibrated exposures to be background subtracted.
masks : `list` [`lsst.afw.image.Mask`]
    Masks associated with the input calibrated exposures.
skyCorrs : `list` [`lsst.afw.math.BackgroundList`]
    Background lists associated with the input calibrated exposures.
skyFrames : `list` [`lsst.afw.image.ExposureF`]
    Sky frame calibration data for the input detectors.

Returns
-------
scale : `float`
    Fitted scale factor applied to the sky frame.

Definition at line 636 of file skyCorrection.py.

◆ _getCalExp()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._getCalExp ( self,
calExpHandle,
mask = None,
skyCorr = None,
backgroundToPhotometricRatioHandle = None )
protected
Get a calexp from a DeferredDatasetHandle, and optionally apply an
updated mask and skyCorr.

Parameters
----------
calExpHandle : `~lsst.afw.image.ExposureF`
        | `lsst.daf.butler.DeferredDatasetHandle`
    Either the image exposure data or a handle to the calexp dataset.
mask : `lsst.afw.image.Mask`, optional
    Mask to apply to the calexp.
skyCorr : `lsst.afw.math.BackgroundList`, optional
    Background list to subtract from the calexp.

Returns
-------
calExp : `lsst.afw.image.ExposureF`
    The calexp with the mask and skyCorr applied.

Definition at line 456 of file skyCorrection.py.

◆ _getSkyFrame()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._getSkyFrame ( self,
skyFrameHandle )
protected
Get a calexp from a DeferredDatasetHandle, and optionally apply an
updated mask and skyCorr.

Parameters
----------
skyFrameHandle : `lsst.daf.butler.DeferredDatasetHandle`
    Either the sky frame data or a handle to the sky frame dataset.

Returns
-------
skyFrame : `lsst.afw.image.ExposureF`
    The calexp with the mask and skyCorr applied.

Definition at line 506 of file skyCorrection.py.

◆ _restoreOriginalBackgroundRefineMask()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._restoreOriginalBackgroundRefineMask ( self,
calExp,
calBkg )
protected
Restore original background to a calexp and invert the related
background model; optionally refine the mask plane.

The original visit-level background is restored to the calibrated
exposure and the existing background model is inverted in-place. If
doMaskObjects is True, the mask map associated with the exposure will
be iteratively updated (over nIter loops) by re-estimating the
background each iteration and redetecting footprints.

The background model modified in-place in this method will comprise the
first N elements of the skyCorr dataset type, i.e., these N elements
are the inverse of the calexpBackground model. All subsequent elements
appended to skyCorr will be additive such that, when skyCorr is
subtracted from a calexp, the net result will be to undo the initial
per-detector background solution and then apply the skyCorr model
thereafter. Adding skyCorr to a calexpBackground will effectively
negate the calexpBackground, returning only the additive background
components of the skyCorr background model.

Parameters
----------
calExp : `lsst.afw.image.ExposureF`
    Detector level calexp image.
calBkg : `lsst.afw.math.BackgroundList`
    Detector level background lists associated with the calexp.

Returns
-------
calExp : `lsst.afw.image.ExposureF`
    The calexp with the originally subtracted background restored.
skyCorrBase : `lsst.afw.math.BackgroundList`
    The inverted original background models; the genesis for skyCorr.

Definition at line 526 of file skyCorrection.py.

◆ _validateBgModel()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._validateBgModel ( self,
bgModelID,
bgModel,
config )
protected
Check that the background model contains enough valid superpixels,
and raise a useful error if not.

Parameters
----------
bgModelID : `str`
    Identifier for the background model.
bgModel : `~lsst.pipe.tasks.background.FocalPlaneBackground`
    Background model to check.
config : `~lsst.pipe.tasks.background.FocalPlaneBackgroundConfig`
    Configuration used to create the background model.

Definition at line 591 of file skyCorrection.py.

◆ run()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask.run ( self,
calExps,
calBkgs,
skyFrames,
camera,
backgroundToPhotometricRatioHandles = [] )
Perform sky correction on a visit.

The original visit-level background is first restored to the calibrated
exposure and the existing background model is inverted in-place. If
doMaskObjects is True, the mask map associated with this exposure will
be iteratively updated (over nIter loops) by re-estimating the
background each iteration and redetecting footprints.

An initial full focal plane sky subtraction (bgModel1) will take place
prior to scaling and subtracting the sky frame.

If doSky is True, the sky frame will be scaled to the flux in the input
visit.

If doBgModel2 is True, a final full focal plane sky subtraction will
take place after the sky frame has been subtracted.

The first N elements of the returned skyCorr will consist of inverted
elements of the calexpBackground model (i.e., subtractive). All
subsequent elements appended to skyCorr thereafter will be additive
such that, when skyCorr is subtracted from a calexp, the net result
will be to undo the initial per-detector background solution and then
apply the skyCorr model thereafter. Adding skyCorr to a
calexpBackground will effectively negate the calexpBackground,
returning only the additive background components of the skyCorr
background model.

Parameters
----------
calExps : `list` [`lsst.afw.image.ExposureF`]
    Detector calibrated exposure images for the visit.
calBkgs : `list` [`lsst.afw.math.BackgroundList`]
    Detector background lists matching the calibrated exposures.
skyFrames : `list` [`lsst.afw.image.ExposureF`]
    Sky frame calibration data for the input detectors.
camera : `lsst.afw.cameraGeom.Camera`
    Camera matching the input data to process.
backgroundToPhotometricRatioHandles :
        `list` [`lsst.daf.butler.DeferredDatasetHandle`], optional
    Deferred dataset handles pointing to the Background to photometric
    ratio images for the input detectors.

Returns
-------
results : `Struct` containing:
    skyFrameScale : `float`
        Scale factor applied to the sky frame.
    skyCorr : `list` [`lsst.afw.math.BackgroundList`]
        Detector-level sky correction background lists.
    calExpMosaic : `lsst.afw.image.ExposureF`
        Visit-level mosaic of the sky corrected data, binned.
        Analogous to `calexp - skyCorr`.
    calBkgMosaic : `lsst.afw.image.ExposureF`
        Visit-level mosaic of the sky correction background, binned.
        Analogous to `calexpBackground + skyCorr`.

Definition at line 279 of file skyCorrection.py.

◆ runQuantum()

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask.runQuantum ( self,
butlerQC,
inputRefs,
outputRefs )

Definition at line 225 of file skyCorrection.py.

Member Data Documentation

◆ _DefaultName

str lsst.pipe.tasks.skyCorrection.SkyCorrectionTask._DefaultName = "skyCorr"
staticprotected

Definition at line 218 of file skyCorrection.py.

◆ ConfigClass

lsst.pipe.tasks.skyCorrection.SkyCorrectionTask.ConfigClass = SkyCorrectionConfig
static

Definition at line 217 of file skyCorrection.py.


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