lsst.meas.algorithms
20.0.0-2-g92e20685+7
|
Subtract the background from an exposure. More...
Public Member Functions | |
def | run (self, exposure, background=None, stats=True, statsKeys=None) |
Fit and subtract the background of an exposure. More... | |
def | fitBackground (self, maskedImage, nx=0, ny=0, algorithm=None) |
Estimate the background of a masked image. More... | |
Static Public Attributes | |
ConfigClass = SubtractBackgroundConfig | |
Subtract the background from an exposure.
Fit a model of the background of an exposure and subtract it.
Call run
to fit the background and subtract it.
Call fitBackground
to fit the background without subtracting it.
The run
method will optionally set the following items of exposure metadata; the names may be overridden; the defaults are shown:
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
.
SubtractBackgroundTask has a debug dictionary containing three integer keys:
fitBackground
displays the unsubtracted masked image overlaid with the grid of cells used to fit the background in the specified frame run
displays the background-subtracted exposure is the specified frame run
displays the background image in the specified frame For example, put something like:
into your debug.py
file and run your task with the --debug
flag.
This code is in subtractBackgroundExample.py in the examples directory, and can be run as:
Import the task (there are some other standard imports; read the file if you're curious)
Create the task, run it, and report mean and variance of background.
Definition at line 126 of file subtractBackground.py.
def lsst.meas.algorithms.subtractBackground.SubtractBackgroundTask.fitBackground | ( | self, | |
maskedImage, | |||
nx = 0 , |
|||
ny = 0 , |
|||
algorithm = None |
|||
) |
Estimate the background of a masked image.
[in] | maskedImage | masked image whose background is to be computed |
[in] | nx | number of x bands; if 0 compute from width and config.binSizeX |
[in] | ny | number of y bands; if 0 compute from height and config.binSizeY |
[in] | algorithm | name of interpolation algorithm; if None use self.config.algorithm |
RuntimeError | if lsst.afw.math.makeBackground returns None, which is apparently one way it indicates failure |
Definition at line 285 of file subtractBackground.py.
def lsst.meas.algorithms.subtractBackground.SubtractBackgroundTask.run | ( | self, | |
exposure, | |||
background = None , |
|||
stats = True , |
|||
statsKeys = None |
|||
) |
Fit and subtract the background of an exposure.
[in,out] | exposure | exposure whose background is to be subtracted |
[in,out] | background | initial background model already subtracted from exposure (an lsst.afw.math.BackgroundList). May be None if no background has been subtracted. |
[in] | stats | if True then measure the mean and variance of the full background model and record the results in the exposure's metadata |
[in] | statsKeys | key names used to store the mean and variance of the background in the exposure's metadata (a pair of strings); if None then use ("BGMEAN", "BGVAR"); ignored if stats is false |
Definition at line 220 of file subtractBackground.py.
|
static |
Definition at line 217 of file subtractBackground.py.