lsst.ip.isr g2ab2c8e58b+c485740ab4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Attributes | List of all members
lsst.ip.isr.overscan.OverscanCorrectionTaskBase Class Reference
Inheritance diagram for lsst.ip.isr.overscan.OverscanCorrectionTaskBase:
lsst.ip.isr.overscan.OverscanCorrectionTask lsst.ip.isr.overscan.ParallelOverscanCorrectionTask lsst.ip.isr.overscan.SerialOverscanCorrectionTask

Public Member Functions

 __init__ (self, statControl=None, **kwargs)
 
 run (self, exposure, amp, isTransposed=False)
 
 correctOverscan (self, exposure, amp, imageBBox, overscanBBox, isTransposed=True, leadingToSkip=0, trailingToSkip=0)
 
 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)
 
 collapseArrayMedian (self, maskedArray)
 
 splineFit (self, indices, collapsed, numBins)
 
 measureVectorOverscan (self, image, isTransposed=False)
 
 debugView (self, image, model, amp=None, isTransposed=True)
 

Static Public Member Functions

 integerConvert (image)
 
 splineEval (indices, interp)
 
 maskExtrapolated (collapsed)
 

Public Attributes

 allowDebug
 
 statControl
 
 splineFit
 
 splineEval
 

Static Public Attributes

 ConfigClass = OverscanCorrectionTaskConfigBase
 

Static Protected Attributes

str _DefaultName = "overscanBase"
 

Detailed Description

Base Correction task for overscan.

This class contains a number of utilities that are easier to
understand and use when they are not embedded in nested if/else
loops.

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

Definition at line 127 of file overscan.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.__init__ ( self,
statControl = None,
** kwargs )

Definition at line 142 of file overscan.py.

Member Function Documentation

◆ broadcastFitToImage()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.broadcastFitToImage ( self,
overscanValue,
imageArray,
transpose = False )
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 267 of file overscan.py.

◆ collapseArray()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.collapseArray ( self,
maskedArray,
fillMasked = True )
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 578 of file overscan.py.

◆ collapseArrayMedian()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.collapseArrayMedian ( self,
maskedArray )
Collapse overscan array (and mask) to a 1-D vector of using the
correct integer median of row-values.

Parameters
----------
maskedArray : `numpy.ma.masked_array`
    Masked array of input overscan data.

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

Definition at line 601 of file overscan.py.

◆ correctOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.correctOverscan ( self,
exposure,
amp,
imageBBox,
overscanBBox,
isTransposed = True,
leadingToSkip = 0,
trailingToSkip = 0 )
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.

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 156 of file overscan.py.

◆ debugView()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.debugView ( self,
image,
model,
amp = None,
isTransposed = True )
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 802 of file overscan.py.

◆ fillMaskedPixels()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.fillMaskedPixels ( self,
overscanVector )
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 537 of file overscan.py.

◆ fitOverscan()

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

Definition at line 364 of file overscan.py.

◆ getImageArray()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.getImageArray ( self,
image )
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 486 of file overscan.py.

◆ integerConvert()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.integerConvert ( image)
static
Return an integer version of the input image.

Parameters
----------
image : `numpy.ndarray`, `lsst.afw.image.Image` or `MaskedImage`
    Image to convert to integers.

Returns
-------
outI : `numpy.ndarray`, `lsst.afw.image.Image` or `MaskedImage`
    The integer converted image.

Raises
------
RuntimeError
    Raised if the input image could not be converted.

Definition at line 395 of file overscan.py.

◆ maskExtrapolated()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.maskExtrapolated ( collapsed)
static
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 695 of file overscan.py.

◆ maskOutliers()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.maskOutliers ( self,
imageArray )
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 505 of file overscan.py.

◆ maskParallelOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.maskParallelOverscan ( self,
exposure,
detector )
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.

Reimplemented in lsst.ip.isr.overscan.ParallelOverscanCorrectionTask.

Definition at line 428 of file overscan.py.

◆ measureConstantOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.measureConstantOverscan ( self,
image )
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 464 of file overscan.py.

◆ measureVectorOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.measureVectorOverscan ( self,
image,
isTransposed = False )
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 723 of file overscan.py.

◆ run()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.run ( self,
exposure,
amp,
isTransposed = False )

◆ splineEval()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.splineEval ( indices,
interp )
static
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 675 of file overscan.py.

◆ splineFit()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.splineFit ( self,
indices,
collapsed,
numBins )
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 629 of file overscan.py.

◆ trimOverscan()

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.trimOverscan ( self,
exposure,
amp,
bbox,
skipLeading,
skipTrailing,
transpose = False )
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 317 of file overscan.py.

Member Data Documentation

◆ _DefaultName

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

Definition at line 140 of file overscan.py.

◆ allowDebug

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.allowDebug

Definition at line 144 of file overscan.py.

◆ ConfigClass

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

Definition at line 139 of file overscan.py.

◆ splineEval

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.splineEval

Definition at line 779 of file overscan.py.

◆ splineFit

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.splineFit

Definition at line 779 of file overscan.py.

◆ statControl

lsst.ip.isr.overscan.OverscanCorrectionTaskBase.statControl

Definition at line 147 of file overscan.py.


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