OverscanCorrectionTask¶
- class lsst.ip.isr.OverscanCorrectionTask(statControl=None, **kwargs)¶
- Bases: - Task- 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:
- statControllsst.afw.math.StatisticsControl, optional
- Statistics control object. 
 
- statControl
 - Methods Summary - broadcastFitToImage(overscanValue, imageArray)- Broadcast 0 or 1 dimension fit to appropriate shape. - collapseArray(maskedArray)- Collapse overscan array (and mask) to a 1-D vector of values. - collapseArrayMedian(maskedArray)- Collapse overscan array (and mask) to a 1-D vector of using the correct integer median of row-values. - correctOverscan(exposure, amp, imageBBox, ...)- debugView(image, model[, amp])- Debug display for the final overscan solution. - Empty (clear) the metadata for this Task and all sub-Tasks. - fitOverscan(overscanImage[, isTransposed])- Get metadata for all tasks. - Get the task name as a hierarchical name including parent task names. - getImageArray(image)- Extract the numpy array from the input image. - getName()- Get the name of the task. - Get a dictionary of all tasks as a shallow copy. - integerConvert(image)- Return an integer version of the input image. - makeField(doc)- Make a - lsst.pex.config.ConfigurableFieldfor this task.- makeSubtask(name, **keyArgs)- Create a subtask as a new instance as the - nameattribute of this task.- maskExtrapolated(collapsed)- Create mask if edges are extrapolated. - maskOutliers(imageArray)- Mask outliers in a row of overscan data from a robust sigma clipping procedure. - measureConstantOverscan(image)- Measure a constant overscan value. - measureVectorOverscan(image[, isTransposed])- Calculate the 1-d vector overscan from the input overscan image. - run(exposure, amp[, isTransposed])- Measure and remove an overscan from an amplifier image. - splineEval(indices, interp)- Wrapper function to match spline evaluation API to polynomial fit API. - splineFit(indices, collapsed, numBins)- Wrapper function to match spline fit API to polynomial fit API. - timer(name[, logLevel])- Context manager to log performance data for an arbitrary block of code. - trimOverscan(exposure, amp, bbox, ...[, ...])- Trim overscan region to remove edges. - Methods Documentation - broadcastFitToImage(overscanValue, imageArray, transpose=False)¶
- Broadcast 0 or 1 dimension fit to appropriate shape. - Parameters:
- overscanValuenumpy.ndarray, (Nrows, ) or scalar
- Overscan fit to broadcast. 
- imageArraynumpy.ndarray, (Nrows, Ncols)
- Image array that we want to match. 
- transposebool, optional
- Switch order to broadcast along the other axis. 
 
- overscanValue
- Returns:
- overscanModelnumpy.ndarray, (Nrows, Ncols) or scalar
- Expanded overscan fit. 
 
- overscanModel
- Raises:
- RuntimeError
- Raised if no axis has the appropriate dimension. 
 
 
 - static collapseArray(maskedArray)¶
- Collapse overscan array (and mask) to a 1-D vector of values. - Parameters:
- maskedArraynumpy.ma.masked_array
- Masked array of input overscan data. 
 
- maskedArray
- Returns:
- collapsednumpy.ma.masked_array
- Single dimensional overscan data, combined with the mean. 
 
- collapsed
 
 - collapseArrayMedian(maskedArray)¶
- Collapse overscan array (and mask) to a 1-D vector of using the correct integer median of row-values. - Parameters:
- maskedArraynumpy.ma.masked_array
- Masked array of input overscan data. 
 
- maskedArray
- Returns:
- collapsednumpy.ma.masked_array
- Single dimensional overscan data, combined with the afwMath median. 
 
- collapsed
 
 - correctOverscan(exposure, amp, imageBBox, overscanBBox, isTransposed=True)¶
 - debugView(image, model, amp=None)¶
- Debug display for the final overscan solution. - Parameters:
- imagelsst.afw.image.Image
- Input image the overscan solution was determined from. 
- modelnumpy.ndarrayorfloat
- Overscan model determined for the image. 
- amplsst.afw.cameraGeom.Amplifier, optional
- Amplifier to extract diagnostic information. 
 
- image
 
 - fitOverscan(overscanImage, isTransposed=False)¶
 - getFullMetadata() TaskMetadata¶
- Get metadata for all tasks. - Returns:
- metadataTaskMetadata
- The keys are the full task name. Values are metadata for the top-level task and all subtasks, sub-subtasks, etc. 
 
- metadata
 - Notes - The returned metadata includes timing information (if - @timer.timeMethodis used) and any metadata set by the task. The name of each item consists of the full task name with- .replaced by- :, followed by- .and the name of the item, e.g.:- topLevelTaskName:subtaskName:subsubtaskName.itemName - using - :in the full task name disambiguates the rare situation that a task has a subtask and a metadata item with the same name.
 - getFullName() str¶
- Get the task name as a hierarchical name including parent task names. - Returns:
- fullNamestr
- The full name consists of the name of the parent task and each subtask separated by periods. For example: - The full name of top-level task “top” is simply “top”. 
- The full name of subtask “sub” of top-level task “top” is “top.sub”. 
- The full name of subtask “sub2” of subtask “sub” of top-level task “top” is “top.sub.sub2”. 
 
 
- fullName
 
 - getImageArray(image)¶
- Extract the numpy array from the input image. - Parameters:
- imagelsst.afw.image.Imageorlsst.afw.image.MaskedImage
- Image data to pull array from. 
- calcImagenumpy.ndarray
- Image data array for numpy operating. 
 
- image
 
 - getTaskDict() Dict[str, ReferenceType[Task]]¶
- Get a dictionary of all tasks as a shallow copy. - Returns:
- taskDictdict
- Dictionary containing full task name: task object for the top-level task and all subtasks, sub-subtasks, etc. 
 
- taskDict
 
 - static integerConvert(image)¶
- Return an integer version of the input image. - Parameters:
- imagenumpy.ndarray,lsst.afw.image.ImageorMaskedImage
- Image to convert to integers. 
 
- image
- Returns:
- outInumpy.ndarray,lsst.afw.image.ImageorMaskedImage
- The integer converted image. 
 
- outI
- Raises:
- RuntimeError
- Raised if the input image could not be converted. 
 
 
 - classmethod makeField(doc: str) ConfigurableField¶
- Make a - lsst.pex.config.ConfigurableFieldfor this task.- Parameters:
- docstr
- Help text for the field. 
 
- doc
- Returns:
- configurableFieldlsst.pex.config.ConfigurableField
- A - ConfigurableFieldfor this task.
 
- configurableField
 - Examples - Provides a convenient way to specify this task is a subtask of another task. - Here is an example of use: - class OtherTaskConfig(lsst.pex.config.Config): aSubtask = ATaskClass.makeField("brief description of task") 
 - makeSubtask(name: str, **keyArgs: Any) None¶
- Create a subtask as a new instance as the - nameattribute of this task.- Parameters:
- namestr
- Brief name of the subtask. 
- keyArgs
- Extra keyword arguments used to construct the task. The following arguments are automatically provided and cannot be overridden: - “config”. 
- “parentTask”. 
 
 
- name
 - Notes - The subtask must be defined by - Task.config.name, an instance of- ConfigurableFieldor- RegistryField.
 - static maskExtrapolated(collapsed)¶
- Create mask if edges are extrapolated. - Parameters:
- collapsednumpy.ma.masked_array
- Masked array to check the edges of. 
 
- collapsed
- Returns:
- maskArraynumpy.ndarray
- Boolean numpy array of pixels to mask. 
 
- maskArray
 
 - maskOutliers(imageArray)¶
- Mask outliers in a row of overscan data from a robust sigma clipping procedure. - Parameters:
- imageArraynumpy.ndarray
- Image to filter along numpy axis=1. 
 
- imageArray
- Returns:
- maskedArraynumpy.ma.masked_array
- Masked image marking outliers. 
 
- maskedArray
 
 - measureConstantOverscan(image)¶
- Measure a constant overscan value. - Parameters:
- imagelsst.afw.image.Imageorlsst.afw.image.MaskedImage
- Image data to measure the overscan from. 
 
- image
- Returns:
- resultslsst.pipe.base.Struct
- Overscan result with entries: - - overscanValue: Overscan value to subtract (- float) -- isTransposed: Orientation of the overscan (- bool)
 
- results
 
 - measureVectorOverscan(image, isTransposed=False)¶
- Calculate the 1-d vector overscan from the input overscan image. - Parameters:
- imagelsst.afw.image.MaskedImage
- Image containing the overscan data. 
- isTransposedbool
- If true, the image has been transposed. 
 
- image
- Returns:
- resultslsst.pipe.base.Struct
- Overscan result with entries: - overscanValue
- Overscan value to subtract ( - float)
- maskArray
- List of rows that should be masked as - SUSPECTwhen 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)
 
 
- results
 
 - run(exposure, amp, isTransposed=False)¶
- Measure and remove an overscan from an amplifier image. - Parameters:
- exposurelsst.afw.image.Exposure
- Image data that will have the overscan corrections applied. 
- amplsst.afw.cameraGeom.Amplifier
- Amplifier to use for debugging purposes. 
- isTransposedbool, optional
- Is the image transposed, such that serial and parallel overscan regions are reversed? Default is False. 
 
- exposure
- Returns:
- overscanResultslsst.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 serial overscan image data (scalar or - lsst.afw.image.Image).
- overscanImage
- Image of the serial overscan region with the serial overscan correction applied ( - lsst.afw.image.Image). This quantity is used to estimate the amplifier read noise empirically.
- parallelOverscanFit
- Value or fit subtracted from the parallel overscan image data (scalar, - lsst.afw.image.Image, or None).
- parallelOverscanImage
- Image of the parallel overscan region with the parallel overscan correction applied ( - lsst.afw.image.Imageor None).
 
 
- overscanResults
- Raises:
- RuntimeError
- Raised if an invalid overscan type is set. 
 
 
 - static splineEval(indices, interp)¶
- Wrapper function to match spline evaluation API to polynomial fit API. - Parameters:
- indicesnumpy.ndarray
- Locations to evaluate the spline. 
- interplsst.afw.math.interpolate
- Interpolation object to use. 
 
- indices
- Returns:
- valuesnumpy.ndarray
- Evaluated spline values at each index. 
 
- values
 
 - splineFit(indices, collapsed, numBins)¶
- Wrapper function to match spline fit API to polynomial fit API. - Parameters:
- indicesnumpy.ndarray
- Locations to evaluate the spline. 
- collapsednumpy.ndarray
- Collapsed overscan values corresponding to the spline evaluation points. 
- numBinsint
- Number of bins to use in constructing the spline. 
 
- indices
- Returns:
- interplsst.afw.math.Interpolate
- Interpolation object for later evaluation. 
 
- interp
 
 - timer(name: str, logLevel: int = 10) Iterator[None]¶
- Context manager to log performance data for an arbitrary block of code. - Parameters:
 - See also - timer.logInfo
 - Examples - Creating a timer context: - with self.timer("someCodeToTime"): pass # code to time 
 - trimOverscan(exposure, amp, bbox, skipLeading, skipTrailing, transpose=False)¶
- Trim overscan region to remove edges. - Parameters:
- exposurelsst.afw.image.Exposure
- Exposure containing data. 
- amplsst.afw.cameraGeom.Amplifier
- Amplifier containing geometry information. 
- bboxlsst.geom.Box2I
- Bounding box of the overscan region. 
- skipLeadingint
- Number of leading (towards data region) rows/columns to skip. 
- skipTrailingint
- Number of trailing (away from data region) rows/columns to skip. 
- transposebool, optional
- Operate on the transposed array. 
 
- exposure
- Returns:
- overscanArraynumpy.array, (N, M)
- Data array to fit. 
- overscanMasknumpy.array, (N, M)
- Data mask. 
 
- overscanArray