IsrTaskLSST¶
- class lsst.ip.isr.IsrTaskLSST(**kwargs)¶
- Bases: - PipelineTask- Attributes Summary - Methods Summary - applyBrighterFatterCorrection(ccdExposure, ...)- countBadPixels(exposure)- Notes - darkCorrection(exposure, darkExposure[, invert])- Apply dark correction in place. - diffNonLinearCorrection(ccdExposure, dnlLUT, ...)- doLinearize(detector)- Check if linearization is needed for the detector cameraGeom. - Empty (clear) the metadata for this Task and all sub-Tasks. - extractCalibDate(calib)- Extract common calibration metadata values that will be written to output header. - flatContext(exp, flat[, dark])- Context manager that applies and removes flats and darks, if the task is configured to apply them. - flatCorrection(exposure, flatExposure[, invert])- Apply flat correction in place. - gainsCorrection(**kwargs)- getBrighterFatterKernel(detector, bfKernel)- Get metadata for all tasks. - Get the task name as a hierarchical name including parent task names. - getLinearizer(detector)- getName()- Get the name of the task. - Get a dictionary of all tasks as a shallow copy. - makeBinnedImages(exposure)- Make visualizeVisit style binned exposures. - 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.- maskDefect(exposure, defectBaseList)- Mask defects using mask plane "BAD", in place. - maskEdges(exposure[, numEdgePixels, ...])- Mask edge pixels with applicable mask plane. - maskFullDefectAmplifiers(ccdExposure, ...)- Check for fully masked bad amplifiers and mask them. - maskNan(exposure)- Mask NaNs using mask plane "UNMASKEDNAN", in place. - maskNegativeVariance(exposure)- Identify and mask pixels with negative variance values. - maskSaturatedPixels(badAmpDict, ccdExposure, ...)- Mask SATURATED and SUSPECT pixels and check if any amplifiers are fully masked. - overscanCorrection(mode, detectorConfig, ...)- Apply serial overscan correction in place to all amps. - run(ccdExposure, *[, dnlLUT, bias, ...])- Run task algorithm on in-memory data. - runQuantum(butlerQC, inputRefs, outputRefs)- Do butler IO and transform to provide in memory objects for tasks - runmethod.- timer(name[, logLevel])- Context manager to log performance data for an arbitrary block of code. - updateVariance(ampExposure, amp[, ptcDataset])- Set the variance plane using the gain and read noise. - validateInput(inputs)- This is a check that all the inputs required by the config are available. - variancePlane(ccdExposure, ccd, ptc)- Attributes Documentation - Methods Documentation - applyBrighterFatterCorrection(ccdExposure, flat, dark, bfKernel, bfGains)¶
 - countBadPixels(exposure)¶
- Notes - Reset and interpolate bad pixels. - Large contiguous bad regions (which should have the BAD mask bit set) should have their values set to the image median. This group should include defects and bad amplifiers. As the area covered by these defects are large, there’s little reason to expect that interpolation would provide a more useful value. - Smaller defects can be safely interpolated after the larger regions have had their pixel values reset. This ensures that the remaining defects adjacent to bad amplifiers (as an example) do not attempt to interpolate extreme values. 
 - darkCorrection(exposure, darkExposure, invert=False)¶
- Apply dark correction in place. - Parameters:
- exposurelsst.afw.image.Exposure
- Exposure to process. 
- darkExposurelsst.afw.image.Exposure
- Dark exposure of the same size as - exposure.
- invertBool, optional
- If True, re-add the dark to an already corrected image. 
 
- exposure
- Raises:
- RuntimeError
- Raised if either - exposureor- darkExposuredo not have their dark time defined.
 
 - See also - lsst.ip.isr.isrFunctions.darkCorrection
 
 - diffNonLinearCorrection(ccdExposure, dnlLUT, **kwargs)¶
 - doLinearize(detector)¶
- Check if linearization is needed for the detector cameraGeom. - Checks config.doLinearize and the linearity type of the first amplifier. - Parameters:
- detectorlsst.afw.cameraGeom.Detector
- Detector to get linearity type from. 
 
- detector
- Returns:
- doLinearizeBool
- If True, linearization should be performed. 
 
- doLinearize
 
 - static extractCalibDate(calib)¶
- Extract common calibration metadata values that will be written to output header. - Parameters:
- caliblsst.afw.image.Exposureorlsst.ip.isr.IsrCalib
- Calibration to pull date information from. 
 
- calib
- Returns:
- dateStringstr
- Calibration creation date string to add to header. 
 
- dateString
 
 - flatContext(exp, flat, dark=None)¶
- Context manager that applies and removes flats and darks, if the task is configured to apply them. - Parameters:
- explsst.afw.image.Exposure
- Exposure to process. 
- flatlsst.afw.image.Exposure
- Flat exposure the same size as - exp.
- darklsst.afw.image.Exposure, optional
- Dark exposure the same size as - exp.
 
- exp
- Yields:
- explsst.afw.image.Exposure
- The flat and dark corrected exposure. 
 
- exp
 
 - flatCorrection(exposure, flatExposure, invert=False)¶
- Apply flat correction in place. - Parameters:
- exposurelsst.afw.image.Exposure
- Exposure to process. 
- flatExposurelsst.afw.image.Exposure
- Flat exposure of the same size as - exposure.
- invertBool, optional
- If True, unflatten an already flattened image. 
 
- exposure
 - See also - lsst.ip.isr.isrFunctions.flatCorrection
 
 - gainsCorrection(**kwargs)¶
 - getBrighterFatterKernel(detector, bfKernel)¶
 - 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
 
 - getLinearizer(detector)¶
 - getName() str¶
- Get the name of the task. - Returns:
- taskNamestr
- Name of the task. 
 
- taskName
 - See also - getFullName
- Get the full name of the task. 
 
 - getTaskDict() dict[str, weakref.ReferenceType[lsst.pipe.base.task.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
 
 - makeBinnedImages(exposure)¶
- Make visualizeVisit style binned exposures. - Parameters:
- exposurelsst.afw.image.Exposure
- Exposure to bin. 
 
- exposure
- Returns:
- bin1lsst.afw.image.Exposure
- Binned exposure using binFactor1. 
- bin2lsst.afw.image.Exposure
- Binned exposure using binFactor2. 
 
- bin1
 
 - 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.
 - maskDefect(exposure, defectBaseList)¶
- Mask defects using mask plane “BAD”, in place. - Parameters:
- exposurelsst.afw.image.Exposure
- Exposure to process. 
- defectBaseListdefect-type
- List of defects to mask. Can be of type - lsst.ip.isr.Defectsor- listof- lsst.afw.image.DefectBase.
 
- exposure
 
 - maskEdges(exposure, numEdgePixels=0, maskPlane='SUSPECT', level='DETECTOR')¶
- Mask edge pixels with applicable mask plane. 
 - maskFullDefectAmplifiers(ccdExposure, detector, defects)¶
- Check for fully masked bad amplifiers and mask them. - Full defect masking happens later to allow for defects which cross amplifier boundaries. - Parameters:
- ccdExposurelsst.afw.image.Exposure
- Input exposure to be masked. 
- detectorlsst.afw.cameraGeom.Detector
- Detector object. 
- defectslsst.ip.isr.Defects
- List of defects. Used to determine if an entire amplifier is bad. 
 
- ccdExposure
- Returns:
- badAmpDictstr`[`bool]
- Dictionary of amplifiers, keyed by name, value is True if amplifier is fully masked. 
 
- badAmpDict
 
 - maskNan(exposure)¶
- Mask NaNs using mask plane “UNMASKEDNAN”, in place. - Parameters:
- exposurelsst.afw.image.Exposure
- Exposure to process. 
 
- exposure
 - Notes - We mask over all non-finite values (NaN, inf), including those that are masked with other bits (because those may or may not be interpolated over later, and we want to remove all NaN/infs). Despite this behaviour, the “UNMASKEDNAN” mask plane is used to preserve the historical name. 
 - maskNegativeVariance(exposure)¶
- Identify and mask pixels with negative variance values. - Parameters:
- exposurelsst.afw.image.Exposure
- Exposure to process. 
 
- exposure
 - See also - lsst.ip.isr.isrFunctions.updateVariance
 
 - maskSaturatedPixels(badAmpDict, ccdExposure, detector)¶
- Mask SATURATED and SUSPECT pixels and check if any amplifiers are fully masked. - Parameters:
- badAmpDictstr[bool]
- Dictionary of amplifiers, keyed by name, value is True if amplifier is fully masked. 
- ccdExposurelsst.afw.image.Exposure
- Input exposure to be masked. 
- detectorlsst.afw.cameraGeom.Detector
- Detector object. 
- defectslsst.ip.isr.Defects
- List of defects. Used to determine if an entire amplifier is bad. 
 
- badAmpDict
- Returns:
- badAmpDictstr`[`bool]
- Dictionary of amplifiers, keyed by name. 
 
- badAmpDict
 
 - overscanCorrection(mode, detectorConfig, detector, badAmpDict, ccdExposure)¶
- Apply serial overscan correction in place to all amps. - The actual overscan subtraction is performed by the - lsst.ip.isr.overscan.OverscanTask, which is called here.- Parameters:
- modestr
- Must be - SERIALor- PARALLEL.
- detectorConfiglsst.ip.isr.OverscanDetectorConfig
- Per-amplifier configurations. 
- detectorlsst.afw.cameraGeom.Detector
- Detector object. 
- badAmpDictdict
- Dictionary of amp name to whether it is a bad amp. 
- ccdExposurelsst.afw.image.Exposure
- Exposure to have overscan correction performed. 
 
- mode
- Returns:
- overscanslist[lsst.pipe.base.Structor None]
- Each result struct has components: - imageFit
- Value or fit subtracted from the amplifier image data. (scalar or - lsst.afw.image.Image)
- overscanFit
- Value or fit subtracted from the overscan image data. (scalar or - lsst.afw.image.Image)
- overscanImage
- Image of the overscan region with the overscan correction applied. This quantity is used to estimate the amplifier read noise empirically. ( - lsst.afw.image.Image)
- overscanMean
- Mean overscan fit value. ( - float)
- overscanMedian
- Median overscan fit value. ( - float)
- overscanSigma
- Clipped standard deviation of the overscan fit. ( - float)
- residualMean
- Mean of the overscan after fit subtraction. ( - float)
- residualMedian
- Median of the overscan after fit subtraction. ( - float)
- residualSigma
- Clipped standard deviation of the overscan after fit subtraction. ( - float)
 
 
- overscans
 - See also - lsst.ip.isr.overscan.OverscanTask
 
 - run(ccdExposure, *, dnlLUT=None, bias=None, deferredChargeCalib=None, linearizer=None, ptc=None, crosstalk=None, defects=None, bfKernel=None, bfGains=None, dark=None, flat=None, camera=None, **kwargs)¶
- Run task algorithm on in-memory data. - This method should be implemented in a subclass. This method will receive keyword arguments whose names will be the same as names of connection fields describing input dataset types. Argument values will be data objects retrieved from data butler. If a dataset type is configured with - multiplefield set to- Truethen the argument value will be a list of objects, otherwise it will be a single object.- If the task needs to know its input or output DataIds then it has to override - runQuantummethod instead.- This method should return a - Structwhose attributes share the same name as the connection fields describing output dataset types.- Parameters:
- **kwargsAny
- Arbitrary parameters accepted by subclasses. 
 
- **kwargs
- Returns:
- structStruct
- Struct with attribute names corresponding to output connection fields. 
 
- struct
 - Examples - Typical implementation of this method may look like: - def run(self, input, calib): # "input", "calib", and "output" are the names of the config # fields # Assuming that input/calib datasets are `scalar` they are # simple objects, do something with inputs and calibs, produce # output image. image = self.makeImage(input, calib) # If output dataset is `scalar` then return object, not list return Struct(output=image) 
 - runQuantum(butlerQC, inputRefs, outputRefs)¶
- Do butler IO and transform to provide in memory objects for tasks - runmethod.- Parameters:
- butlerQCQuantumContext
- A butler which is specialized to operate in the context of a - lsst.daf.butler.Quantum.
- inputRefsInputQuantizedConnection
- Datastructure whose attribute names are the names that identify connections defined in corresponding - PipelineTaskConnectionsclass. The values of these attributes are the- lsst.daf.butler.DatasetRefobjects associated with the defined input/prerequisite connections.
- outputRefsOutputQuantizedConnection
- Datastructure whose attribute names are the names that identify connections defined in corresponding - PipelineTaskConnectionsclass. The values of these attributes are the- lsst.daf.butler.DatasetRefobjects associated with the defined output connections.
 
- butlerQC
 
 - timer(name: str, logLevel: int = 10) Iterator[None]¶
- Context manager to log performance data for an arbitrary block of code. - Parameters:
 - See also - lsst.utils.timer.logInfo
- Implementation function. 
 - Examples - Creating a timer context: - with self.timer("someCodeToTime"): pass # code to time 
 - updateVariance(ampExposure, amp, ptcDataset=None)¶
- Set the variance plane using the gain and read noise. - Parameters:
- ampExposurelsst.afw.image.Exposure
- Exposure to process. 
- amplsst.afw.cameraGeom.AmplifierorFakeAmp
- Amplifier detector data. 
- ptcDatasetlsst.ip.isr.PhotonTransferCurveDataset, optional
- PTC dataset containing the gains and read noise. 
 
- ampExposure
- Raises:
- RuntimeError
- Raised if ptcDataset is not provided. 
 
 - See also - lsst.ip.isr.isrFunctions.updateVariance
 
 - validateInput(inputs)¶
- This is a check that all the inputs required by the config are available. 
 - variancePlane(ccdExposure, ccd, ptc)¶