LSST Applications 24.1.5,g02d81e74bb+fa3a7a026e,g180d380827+a53a32eff8,g2079a07aa2+86d27d4dc4,g2305ad1205+c0501b3732,g295015adf3+7d3e92f0ec,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+5dd1654d75,g48712c4677+3bf1020dcb,g487adcacf7+065c13d9cf,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+d7ac436cfb,g5a732f18d5+53520f316c,g64a986408d+fa3a7a026e,g858d7b2824+fa3a7a026e,g8a8a8dda67+585e252eca,g99cad8db69+a5a909b84f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+4cf350ccb2,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+f991a0b59f,gc120e1dc64+9ccbfdb8be,gc28159a63d+0e5473021a,gcf0d15dbbd+5dd1654d75,gd96a1ce819+42fd0ee607,gdaeeff99f8+f9a426f77a,ge6526c86ff+0d71447b4b,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+fa3a7a026e
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Static Protected Attributes | List of all members
lsst.ip.isr.crosstalk.CrosstalkTask Class Reference
Inheritance diagram for lsst.ip.isr.crosstalk.CrosstalkTask:
lsst.ip.isr.crosstalk.NullCrosstalkTask lsst.obs.decam.crosstalk.DecamCrosstalkTask

Public Member Functions

 run (self, exposure, crosstalk=None, crosstalkSources=None, isTrimmed=False, camera=None, parallelOverscanRegion=False, detectorConfig=None)
 

Static Public Attributes

 ConfigClass = CrosstalkConfig
 

Static Protected Attributes

str _DefaultName = 'isrCrosstalk'
 

Detailed Description

Apply intra-detector crosstalk correction.

Definition at line 736 of file crosstalk.py.

Member Function Documentation

◆ run()

lsst.ip.isr.crosstalk.CrosstalkTask.run ( self,
exposure,
crosstalk = None,
crosstalkSources = None,
isTrimmed = False,
camera = None,
parallelOverscanRegion = False,
detectorConfig = None )
Apply intra-detector crosstalk correction

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure for which to remove crosstalk.
crosstalkCalib : `lsst.ip.isr.CrosstalkCalib`, optional
    External crosstalk calibration to apply.  Constructed from
    detector if not found.
crosstalkSources : `defaultdict`, optional
    Image data for other detectors that are sources of
    crosstalk in exposure.  The keys are expected to be names
    of the other detectors, with the values containing
    `lsst.afw.image.Exposure` at the same level of processing
    as ``exposure``.
    The default for intra-detector crosstalk here is None.
isTrimmed : `bool`, optional
    The image is already trimmed.
    This should no longer be needed once DM-15409 is resolved.
camera : `lsst.afw.cameraGeom.Camera`, optional
    Camera associated with this exposure.  Only used for
    inter-chip matching.
parallelOverscanRegion : `bool`, optional
    Do subtraction in parallel overscan region (only)?
detectorConfig : `lsst.ip.isr.OverscanDetectorConfig`, optional
    Per-amplifier configs used when parallelOverscanRegion=True.

Raises
------
RuntimeError
    Raised if called for a detector that does not have a
    crosstalk correction.  Also raised if the crosstalkSource
    is not an expected type.

Reimplemented in lsst.ip.isr.crosstalk.NullCrosstalkTask.

Definition at line 741 of file crosstalk.py.

745 ):
746 """Apply intra-detector crosstalk correction
747
748 Parameters
749 ----------
750 exposure : `lsst.afw.image.Exposure`
751 Exposure for which to remove crosstalk.
752 crosstalkCalib : `lsst.ip.isr.CrosstalkCalib`, optional
753 External crosstalk calibration to apply. Constructed from
754 detector if not found.
755 crosstalkSources : `defaultdict`, optional
756 Image data for other detectors that are sources of
757 crosstalk in exposure. The keys are expected to be names
758 of the other detectors, with the values containing
759 `lsst.afw.image.Exposure` at the same level of processing
760 as ``exposure``.
761 The default for intra-detector crosstalk here is None.
762 isTrimmed : `bool`, optional
763 The image is already trimmed.
764 This should no longer be needed once DM-15409 is resolved.
765 camera : `lsst.afw.cameraGeom.Camera`, optional
766 Camera associated with this exposure. Only used for
767 inter-chip matching.
768 parallelOverscanRegion : `bool`, optional
769 Do subtraction in parallel overscan region (only)?
770 detectorConfig : `lsst.ip.isr.OverscanDetectorConfig`, optional
771 Per-amplifier configs used when parallelOverscanRegion=True.
772
773 Raises
774 ------
775 RuntimeError
776 Raised if called for a detector that does not have a
777 crosstalk correction. Also raised if the crosstalkSource
778 is not an expected type.
779 """
780 if not crosstalk:
781 crosstalk = CrosstalkCalib(log=self.log)
782 crosstalk = crosstalk.fromDetector(exposure.getDetector(),
783 coeffVector=self.config.crosstalkValues)
784 if not crosstalk.log:
785 crosstalk.log = self.log
786 if not crosstalk.hasCrosstalk:
787 raise RuntimeError("Attempted to correct crosstalk without crosstalk coefficients.")
788 elif parallelOverscanRegion:
789 self.log.info("Applying crosstalk correction to parallel overscan region.")
790 crosstalk.subtractCrosstalkParallelOverscanRegion(
791 exposure,
792 crosstalkCoeffs=crosstalk.coeffs,
793 detectorConfig=detectorConfig,
794 )
795 else:
796 self.log.info("Applying crosstalk correction.")
797 crosstalk.subtractCrosstalk(exposure, crosstalkCoeffs=crosstalk.coeffs,
798 minPixelToMask=self.config.minPixelToMask,
799 crosstalkStr=self.config.crosstalkMaskPlane, isTrimmed=isTrimmed,
800 backgroundMethod=self.config.crosstalkBackgroundMethod)
801
802 if crosstalk.interChip:
803 if crosstalkSources:
804 # Parse crosstalkSources: Identify which detectors we have
805 # available
806 if isinstance(crosstalkSources[0], lsst.afw.image.Exposure):
807 # Received afwImage.Exposure
808 sourceNames = [exp.getDetector().getName() for exp in crosstalkSources]
809 elif isinstance(crosstalkSources[0], lsst.daf.butler.DeferredDatasetHandle):
810 # Received dafButler.DeferredDatasetHandle
811 detectorList = [source.dataId['detector'] for source in crosstalkSources]
812 sourceNames = [camera[detector].getName() for detector in detectorList]
813 else:
814 raise RuntimeError("Unknown object passed as crosstalk sources.",
815 type(crosstalkSources[0]))
816
817 for detName in crosstalk.interChip:
818 if detName not in sourceNames:
819 self.log.warning("Crosstalk lists %s, not found in sources: %s",
820 detName, sourceNames)
821 continue
822 # Get the coefficients.
823 interChipCoeffs = crosstalk.interChip[detName]
824
825 sourceExposure = crosstalkSources[sourceNames.index(detName)]
826 if isinstance(sourceExposure, lsst.daf.butler.DeferredDatasetHandle):
827 # Dereference the dafButler.DeferredDatasetHandle.
828 sourceExposure = sourceExposure.get()
829 if not isinstance(sourceExposure, lsst.afw.image.Exposure):
830 raise RuntimeError("Unknown object passed as crosstalk sources.",
831 type(sourceExposure))
832
833 self.log.info("Correcting detector %s with ctSource %s",
834 exposure.getDetector().getName(),
835 sourceExposure.getDetector().getName())
836 crosstalk.subtractCrosstalk(exposure, sourceExposure=sourceExposure,
837 crosstalkCoeffs=interChipCoeffs,
838 minPixelToMask=self.config.minPixelToMask,
839 crosstalkStr=self.config.crosstalkMaskPlane,
840 isTrimmed=isTrimmed,
841 backgroundMethod=self.config.crosstalkBackgroundMethod)
842 else:
843 self.log.warning("Crosstalk contains interChip coefficients, but no sources found!")
844
845
A class to contain the data, WCS, and other information needed to describe an image of the sky.
Definition Exposure.h:72

Member Data Documentation

◆ _DefaultName

str lsst.ip.isr.crosstalk.CrosstalkTask._DefaultName = 'isrCrosstalk'
staticprotected

Definition at line 739 of file crosstalk.py.

◆ ConfigClass

lsst.ip.isr.crosstalk.CrosstalkTask.ConfigClass = CrosstalkConfig
static

Definition at line 738 of file crosstalk.py.


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