lsst.ip.isr gbffcd5fa91+90bfeb2273
Loading...
Searching...
No Matches
lsst.ip.isr.overscan.ParallelOverscanCorrectionTask Class Reference
Inheritance diagram for lsst.ip.isr.overscan.ParallelOverscanCorrectionTask:
lsst.ip.isr.overscan.OverscanCorrectionTaskBase

Public Member Functions

 run (self, exposure, amp, isTransposed=False)
 
 maskParallelOverscanAmp (self, exposure, amp, saturationLevel=None)
 
 correctOverscan (self, exposure, amp, imageBBox, overscanBBox, isTransposed=True, leadingToSkip=0, trailingToSkip=0, overscanFraction=1.0, imageThreshold=np.inf, maskedRowColumnGrowSize=0, medianSmoothingKernel=0, medianSmoothingOutlierThreshold=np.inf)
 
 broadcastFitToImage (self, overscanValue, imageArray, transpose=False)
 
 trimOverscan (self, exposure, amp, bbox, skipLeading, skipTrailing, transpose=False)
 
 fitOverscan (self, overscanImage, isTransposed=False)
 
 maskParallelOverscan (self, exposure, detector)
 
 measureConstantOverscan (self, image)
 
 getImageArray (self, image)
 
 maskOutliers (self, imageArray)
 
 fillMaskedPixels (self, overscanVector)
 
 collapseArray (self, maskedArray, fillMasked=True)
 
 splineFit (self, indices, collapsed, numBins)
 
 measureVectorOverscan (self, image, isTransposed=False)
 
 debugView (self, image, model, amp=None, isTransposed=True)
 

Static Public Member Functions

 splineEval (indices, interp)
 
 maskExtrapolated (collapsed)
 

Public Attributes

bool allowDebug = True
 
 statControl = statControl
 

Static Public Attributes

 ConfigClass = OverscanCorrectionTaskConfigBase
 

Static Protected Member Functions

 _maskRowsOrColumns (exposure, overscanBBox, overscanMaskedImage, overscanMask, maxDeviation, maskedRowColumnGrowSize, medianSmoothingKernel, medianSmoothingOutlierThreshold, doAbsoluteMaxDeviation, isTransposed)
 

Static Protected Attributes

str _DefaultName = "overscanBase"
 

Detailed Description

Correction task for parallel overscan.

Parameters
----------
statControl : `lsst.afw.math.StatisticsControl`, optional
    Statistics control object.

Definition at line 1425 of file overscan.py.

Member Function Documentation

◆ _maskRowsOrColumns()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase._maskRowsOrColumns ( exposure,
overscanBBox,
overscanMaskedImage,
overscanMask,
maxDeviation,
maskedRowColumnGrowSize,
medianSmoothingKernel,
medianSmoothingOutlierThreshold,
doAbsoluteMaxDeviation,
isTransposed )
staticprotectedinherited
Mask overscan rows (~serial) or columns (~parallel).

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure containing the data.
overscanBBox: `lsst.geom.Box2I`
    Bounding box for the overscan data.
overscanMaskedImage : `lsst.afw.image.MaskedImage`
    Masked image containing the overscan data.
overscanMask : `np.ndarray`
    Numpy array of the mask bits, anded with appropriate
    mask planes.
maxDeviation : `float`
    Maximum deviation from median (overscan units) to mask in overscan
    correction. For parallel overscan this is a one-sided (positive
    only) cut.
maskedRowColumnGrowSize : `int`
    If a column (parallel overscan) or row (serial overscan) is
    completely masked, then grow the mask by this radius. If the
    value is <=0 then this will not be checked.
medianSmoothingKernel : `int`
    Kernel (pixels) to smooth rows/columns. If <=0, median smoothing
    is skipped. Otherwise must be odd.
medianSmoothingOutlierThreshold : `float`
    Outlier threshold after median smoothing (overscan units). This
    is applied only to positive outliers.
doAbsoluteMaxDeviation : `bool`
    If true, deviation comparisons will use the absolute value;
    otherwise it will cut positive outliers only.
isTransposed : `bool`
    If true, then the data will be transposed before fitting
    the overscan.

Returns
-------
badRowsOrColumns : `np.ndarray`
    Array of bad rows (serial) or columns (parallel) that were
    found, prior to dilation by maskedRowColumnGrowSize.

Definition at line 167 of file overscan.py.

◆ broadcastFitToImage()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.broadcastFitToImage ( self,
overscanValue,
imageArray,
transpose = False )
inherited
Broadcast 0 or 1 dimension fit to appropriate shape.

Parameters
----------
overscanValue : `numpy.ndarray`, (Nrows, ) or scalar
    Overscan fit to broadcast.
imageArray : `numpy.ndarray`, (Nrows, Ncols)
    Image array that we want to match.
transpose : `bool`, optional
    Switch order to broadcast along the other axis.

Returns
-------
overscanModel : `numpy.ndarray`, (Nrows, Ncols) or scalar
    Expanded overscan fit.

Raises
------
RuntimeError
    Raised if no axis has the appropriate dimension.

Definition at line 485 of file overscan.py.

◆ collapseArray()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.collapseArray ( self,
maskedArray,
fillMasked = True )
inherited
Collapse overscan array (and mask) to a 1-D vector of values.

Parameters
----------
maskedArray : `numpy.ma.masked_array`
    Masked array of input overscan data.
fillMasked : `bool`, optional
    If true, fill any pixels that are masked with a median of
    neighbors.

Returns
-------
collapsed : `numpy.ma.masked_array`
    Single dimensional overscan data, combined with the mean.

Definition at line 763 of file overscan.py.

◆ correctOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.correctOverscan ( self,
exposure,
amp,
imageBBox,
overscanBBox,
isTransposed = True,
leadingToSkip = 0,
trailingToSkip = 0,
overscanFraction = 1.0,
imageThreshold = np.inf,
maskedRowColumnGrowSize = 0,
medianSmoothingKernel = 0,
medianSmoothingOutlierThreshold = np.inf )
inherited
Trim the exposure, fit the overscan, subtract the fit, and
calculate statistics.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure containing the data.
amp : `lsst.afw.cameraGeom.Amplifier`
    The amplifier that is to be corrected.
imageBBox: `lsst.geom.Box2I`
    Bounding box of the image data that will have the overscan
    subtracted.  If parallel overscan will be performed, that
    area is added to the image bounding box during serial
    overscan correction.
overscanBBox: `lsst.geom.Box2I`
    Bounding box for the overscan data.
isTransposed: `bool`
    If true, then the data will be transposed before fitting
    the overscan.
leadingToSkip : `int`, optional
    Leading rows/columns to skip.
trailingToSkip : `int`, optional
    Leading rows/columns to skip.
overscanFraction : `float`, optional
    If the overscan region median is greater than overscanFraction
    and the imaging region median is greater than imageThreshold
    then overscan correction will be skipped.
maxLevel : `float`, optional
    If the overscan region median is greater than overscanFraction
    and the imaging region median is greater than imageThreshold
    then overscan correction will be skipped.
maskedRowColumnGrowSize : `int`, optional
    If a column (parallel overscan) or row (serial overscan) is
    completely masked, then grow the mask by this radius. If the
    value is <=0 then this will not be checked.
medianSmoothingKernel : `int`, optional
    Kernel (pixels) to use to smooth rows/columns for row/column
    outlier rejection. Must be odd if positive; if <=0 median
    smoothing will not be used to find outliers.
medianSmoothingOutlierThreshold : `float`, optional
    Threshold to look for outliers after median smoothing (adu).

Returns
-------
results : `lsst.pipe.base.Struct`
    ``ampOverscanModel``
        Overscan model broadcast to the full image size.
        (`lsst.afw.image.Exposure`)
    ``overscanOverscanModel``
        Overscan model broadcast to the full overscan image
        size. (`lsst.afw.image.Exposure`)
    ``overscanImage``
        Overscan image with the overscan fit subtracted.
        (`lsst.afw.image.Exposure`)
    ``overscanValue``
        Overscan model. (`float` or `np.array`)
    ``overscanMean``
        Mean value of the overscan fit. (`float`)
    ``overscanMedian``
        Median value of the overscan fit. (`float`)
    ``overscanSigma``
        Standard deviation of the overscan fit. (`float`)
    ``overscanMeanResidual``
        Mean value of the overscan region after overscan
        subtraction. (`float`)
    ``overscanMedianResidual``
        Median value of the overscan region after overscan
        subtraction. (`float`)
    ``overscanSigmaResidual``
        Standard deviation of the overscan region after
        overscan subtraction. (`float`)

Definition at line 297 of file overscan.py.

◆ debugView()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.debugView ( self,
image,
model,
amp = None,
isTransposed = True )
inherited
Debug display for the final overscan solution.

Parameters
----------
image : `lsst.afw.image.Image`
    Input image the overscan solution was determined from.
model : `numpy.ndarray` or `float`
    Overscan model determined for the image.
amp : `lsst.afw.cameraGeom.Amplifier`, optional
    Amplifier to extract diagnostic information.
isTransposed : `bool`, optional
    Does the data need to be transposed before display?

Definition at line 967 of file overscan.py.

◆ fillMaskedPixels()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.fillMaskedPixels ( self,
overscanVector )
inherited
Fill masked/NaN pixels in the overscan.

Parameters
----------
overscanVector : `np.array` or `np.ma.masked_array`
    Overscan vector to fill.

Returns
-------
overscanVector : `np.ma.masked_array`
    Filled vector.

Notes
-----
Each maskSlice is a section of overscan with contiguous masks.
Ideally this adds 5 pixels from the left and right of that
mask slice, and takes the median of those values to fill the
slice.  If this isn't possible, the median of all non-masked
values is used.  The mask is removed for the pixels filled.

Definition at line 722 of file overscan.py.

◆ fitOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.fitOverscan ( self,
overscanImage,
isTransposed = False )
inherited

Definition at line 582 of file overscan.py.

◆ getImageArray()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.getImageArray ( self,
image )
inherited
Extract the numpy array from the input image.

Parameters
----------
image : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
    Image data to pull array from.

calcImage : `numpy.ndarray`
    Image data array for numpy operating.

Definition at line 671 of file overscan.py.

◆ maskExtrapolated()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.maskExtrapolated ( collapsed)
staticinherited
Create mask if edges are extrapolated.

Parameters
----------
collapsed : `numpy.ma.masked_array`
    Masked array to check the edges of.

Returns
-------
maskArray : `numpy.ndarray`
    Boolean numpy array of pixels to mask.

Definition at line 852 of file overscan.py.

◆ maskOutliers()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.maskOutliers ( self,
imageArray )
inherited
Mask  outliers in  a  row  of overscan  data  from  a robust  sigma
clipping procedure.

Parameters
----------
imageArray : `numpy.ndarray`
    Image to filter along numpy axis=1.

Returns
-------
maskedArray : `numpy.ma.masked_array`
    Masked image marking outliers.

Definition at line 690 of file overscan.py.

◆ maskParallelOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.maskParallelOverscan ( self,
exposure,
detector )
inherited
Mask the union of high values on all amplifiers in the parallel
overscan.

This operates on the image in-place.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    An untrimmed raw exposure.
detector : `lsst.afw.cameraGeom.Detector`
    The detetor to use for amplifier geometry.

Definition at line 612 of file overscan.py.

◆ maskParallelOverscanAmp()

lsst.ip.isr.overscan.ParallelOverscanCorrectionTask.maskParallelOverscanAmp ( self,
exposure,
amp,
saturationLevel = None )
Mask parallel overscan, growing saturated pixels.

This operates on the image in-place.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    An untrimmed raw exposure.
amp : `lsst.afw.cameraGeom.Amplifier`
    The amplifier to use for masking.
saturationLevel : `float`, optional
    Saturation level to use for masking.

Definition at line 1542 of file overscan.py.

◆ measureConstantOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.measureConstantOverscan ( self,
image )
inherited
Measure a constant overscan value.

Parameters
----------
image : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
    Image data to measure the overscan from.

Returns
-------
results : `lsst.pipe.base.Struct`
    Overscan result with entries:
    - ``overscanValue``: Overscan value to subtract (`float`)
    - ``isTransposed``: Orientation of the overscan (`bool`)

Definition at line 649 of file overscan.py.

◆ measureVectorOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.measureVectorOverscan ( self,
image,
isTransposed = False )
inherited
Calculate the 1-d vector overscan from the input overscan image.

Parameters
----------
image : `lsst.afw.image.MaskedImage`
    Image containing the overscan data.
isTransposed : `bool`
    If true, the image has been transposed.

Returns
-------
results : `lsst.pipe.base.Struct`
    Overscan result with entries:

    ``overscanValue``
        Overscan value to subtract (`float`)
    ``maskArray``
        List of rows that should be masked as ``SUSPECT`` when the
        overscan solution is applied. (`list` [ `bool` ])
    ``isTransposed``
       Indicates if the overscan data was transposed during
       calcuation, noting along which axis the overscan should be
       subtracted. (`bool`)

Definition at line 880 of file overscan.py.

◆ run()

lsst.ip.isr.overscan.ParallelOverscanCorrectionTask.run ( self,
exposure,
amp,
isTransposed = False )
Measure and remove parallel overscan from an amplifier image.

This method assumes that serial overscan has already been
removed from the amplifier.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Image data that will have the overscan corrections applied.
amp : `lsst.afw.cameraGeom.Amplifier`
    Amplifier to use for debugging purposes.
isTransposed : `bool`, optional
    Is the image transposed, such that serial and parallel
    overscan regions are reversed?  Default is False.

Returns
-------
overscanResults : `lsst.pipe.base.Struct`
    Result struct with components:

    ``imageFit``
        Value or fit subtracted from the amplifier image data
        (scalar or `lsst.afw.image.Image`).
    ``overscanFit``
        Value or fit subtracted from the parallel overscan image
        data (scalar or `lsst.afw.image.Image`).
    ``overscanImage``
        Image of the parallel overscan region with the parallel
        overscan correction applied
        (`lsst.afw.image.Image`). This quantity is used to
        estimate the amplifier read noise empirically.
    ``overscanMean``
        Mean of the fit parallel overscan region.
    ``overscanMedian``
        Median of the fit parallel overscan region.
    ``overscanSigma``
        Sigma of the fit parallel overscan region.
    ``residualMean``
        Mean of the residual of the parallel overscan region after
        correction.
    ``residualMedian``
        Median of the residual of the parallel overscan region after
        correction.
    ``residualSigma``
        Mean of the residual of the parallel overscan region after
        correction.

Raises
------
RuntimeError
    Raised if an invalid overscan type is set.

Reimplemented from lsst.ip.isr.overscan.OverscanCorrectionTaskBase.

Definition at line 1436 of file overscan.py.

◆ splineEval()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.splineEval ( indices,
interp )
staticinherited
Wrapper function to match spline evaluation API to polynomial fit
API.

Parameters
----------
indices : `numpy.ndarray`
    Locations to evaluate the spline.
interp : `lsst.afw.math.interpolate`
    Interpolation object to use.

Returns
-------
values : `numpy.ndarray`
    Evaluated spline values at each index.

Definition at line 832 of file overscan.py.

◆ splineFit()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.splineFit ( self,
indices,
collapsed,
numBins )
inherited
Wrapper function to match spline fit API to polynomial fit API.

Parameters
----------
indices : `numpy.ndarray`
    Locations to evaluate the spline.
collapsed : `numpy.ndarray`
    Collapsed overscan values corresponding to the spline
    evaluation points.
numBins : `int`
    Number of bins to use in constructing the spline.

Returns
-------
interp : `lsst.afw.math.Interpolate`
    Interpolation object for later evaluation.

Definition at line 786 of file overscan.py.

◆ trimOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.trimOverscan ( self,
exposure,
amp,
bbox,
skipLeading,
skipTrailing,
transpose = False )
inherited
Trim overscan region to remove edges.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure containing data.
amp : `lsst.afw.cameraGeom.Amplifier`
    Amplifier containing geometry information.
bbox : `lsst.geom.Box2I`
    Bounding box of the overscan region.
skipLeading : `int`
    Number of leading (towards data region) rows/columns to skip.
skipTrailing : `int`
    Number of trailing (away from data region) rows/columns to skip.
transpose : `bool`, optional
    Operate on the transposed array.

Returns
-------
overscanArray : `numpy.array`, (N, M)
    Data array to fit.
overscanMask : `numpy.array`, (N, M)
    Data mask.

Definition at line 535 of file overscan.py.

Member Data Documentation

◆ _DefaultName

str lsst.ip.isr.overscan.OverscanCorrectionTaskBase._DefaultName = "overscanBase"
staticprotectedinherited

Definition at line 150 of file overscan.py.

◆ allowDebug

bool lsst.ip.isr.overscan.OverscanCorrectionTaskBase.allowDebug = True
inherited

Definition at line 154 of file overscan.py.

◆ ConfigClass

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.ConfigClass = OverscanCorrectionTaskConfigBase
staticinherited

Definition at line 149 of file overscan.py.

◆ statControl

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.statControl = statControl
inherited

Definition at line 157 of file overscan.py.


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