SubtractBackgroundTask#

class lsst.meas.algorithms.SubtractBackgroundTask(config=None, *, name=None, parentTask=None, log=None)#

Bases: Task

Subtract the background from an exposure

Methods Summary

fitBackground(maskedImage[, nx, ny, algorithm])

Estimate the background of a masked image

run(exposure[, background, stats, ...])

Fit and subtract the background of an exposure.

Methods Documentation

fitBackground(maskedImage, nx=0, ny=0, algorithm=None)#

Estimate the background of a masked image

Parameters#

maskedImagelsst.afw.image.maskedImage

Masked image whose background is to be computed

nx‘int`

Number of x bands; if 0 compute from width and self.config.binSizeX

nyint

Number of y bands; if 0 compute from height and self.config.binSizeY

algorithmstr

Name of interpolation algorithm; if None use self.config.algorithm

Returns#

bglsst.afw.math.Background

A fit background

Raises#

RuntimeError

Raised if lsst.afw.math.makeBackground returns None, an indicator of failure.

run(exposure, background=None, stats=True, statsKeys=None, backgroundToPhotometricRatio=None)#

Fit and subtract the background of an exposure.

Parameters#

exposurelsst.afw.image.Exposure

Exposure whose background is to be subtracted.

backgroundlsst.afw.math.BackgroundList

Initial background model already subtracted. May be None if no background has been subtracted.

statsbool

If True then measure the mean and variance of the full background model and record the results in the exposure’s metadata.

statsKeystuple

Key names used to store the mean and variance of the background in the exposure’s metadata (another tuple); if None then use (“BGMEAN”, “BGVAR”); ignored if stats is false.

backgroundToPhotometricRatiolsst.afw.image.Image, optional

Image to multiply a photometrically-flattened image by to obtain a background-flattened image. Only used if config.doApplyFlatBackgroundRatio = True.

Returns#

backgroundlsst.afw.math.BackgroundList

Full background model (initial model with changes), contained in an lsst.pipe.base.Struct.