LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Static Public 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

def prepCrosstalk (self, dataRef, crosstalk=None)
 
def run (self, exposure, crosstalk=None, crosstalkSources=None, isTrimmed=False, camera=None)
 

Static Public Attributes

 ConfigClass = CrosstalkConfig
 

Detailed Description

Apply intra-detector crosstalk correction.

Definition at line 659 of file crosstalk.py.

Member Function Documentation

◆ prepCrosstalk()

def lsst.ip.isr.crosstalk.CrosstalkTask.prepCrosstalk (   self,
  dataRef,
  crosstalk = None 
)
Placeholder for crosstalk preparation method, e.g., for inter-detector crosstalk.

Parameters
----------
dataRef : `daf.persistence.butlerSubset.ButlerDataRef`
    Butler reference of the detector data to be processed.
crosstalk : `~lsst.ip.isr.CrosstalkConfig`
    Crosstalk calibration that will be used.

See also
--------
lsst.obs.decam.crosstalk.DecamCrosstalkTask.prepCrosstalk

Reimplemented in lsst.obs.decam.crosstalk.DecamCrosstalkTask.

Definition at line 664 of file crosstalk.py.

664  def prepCrosstalk(self, dataRef, crosstalk=None):
665  """Placeholder for crosstalk preparation method, e.g., for inter-detector crosstalk.
666 
667  Parameters
668  ----------
669  dataRef : `daf.persistence.butlerSubset.ButlerDataRef`
670  Butler reference of the detector data to be processed.
671  crosstalk : `~lsst.ip.isr.CrosstalkConfig`
672  Crosstalk calibration that will be used.
673 
674  See also
675  --------
676  lsst.obs.decam.crosstalk.DecamCrosstalkTask.prepCrosstalk
677  """
678  return
679 

◆ run()

def lsst.ip.isr.crosstalk.CrosstalkTask.run (   self,
  exposure,
  crosstalk = None,
  crosstalkSources = None,
  isTrimmed = False,
  camera = 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.

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.

Definition at line 680 of file crosstalk.py.

681  crosstalkSources=None, isTrimmed=False, camera=None):
682  """Apply intra-detector crosstalk correction
683 
684  Parameters
685  ----------
686  exposure : `lsst.afw.image.Exposure`
687  Exposure for which to remove crosstalk.
688  crosstalkCalib : `lsst.ip.isr.CrosstalkCalib`, optional
689  External crosstalk calibration to apply. Constructed from
690  detector if not found.
691  crosstalkSources : `defaultdict`, optional
692  Image data for other detectors that are sources of
693  crosstalk in exposure. The keys are expected to be names
694  of the other detectors, with the values containing
695  `lsst.afw.image.Exposure` at the same level of processing
696  as ``exposure``.
697  The default for intra-detector crosstalk here is None.
698  isTrimmed : `bool`, optional
699  The image is already trimmed.
700  This should no longer be needed once DM-15409 is resolved.
701  camera : `lsst.afw.cameraGeom.Camera`, optional
702  Camera associated with this exposure. Only used for
703  inter-chip matching.
704 
705  Raises
706  ------
707  RuntimeError
708  Raised if called for a detector that does not have a
709  crosstalk correction. Also raised if the crosstalkSource
710  is not an expected type.
711  """
712  if not crosstalk:
713  crosstalk = CrosstalkCalib(log=self.log)
714  crosstalk = crosstalk.fromDetector(exposure.getDetector(),
715  coeffVector=self.config.crosstalkValues)
716  if not crosstalk.log:
717  crosstalk.log = self.log
718  if not crosstalk.hasCrosstalk:
719  raise RuntimeError("Attempted to correct crosstalk without crosstalk coefficients.")
720 
721  else:
722  self.log.info("Applying crosstalk correction.")
723  crosstalk.subtractCrosstalk(exposure, crosstalkCoeffs=crosstalk.coeffs,
724  minPixelToMask=self.config.minPixelToMask,
725  crosstalkStr=self.config.crosstalkMaskPlane, isTrimmed=isTrimmed,
726  backgroundMethod=self.config.crosstalkBackgroundMethod)
727 
728  if crosstalk.interChip:
729  if crosstalkSources:
730  # Parse crosstalkSources: Identify which detectors we have available
731  if isinstance(crosstalkSources[0], lsst.afw.image.Exposure):
732  # Received afwImage.Exposure
733  sourceNames = [exp.getDetector().getName() for exp in crosstalkSources]
734  elif isinstance(crosstalkSources[0], lsst.daf.butler.DeferredDatasetHandle):
735  # Received dafButler.DeferredDatasetHandle
736  detectorList = [source.dataId['detector'] for source in crosstalkSources]
737  sourceNames = [camera[detector].getName() for detector in detectorList]
738  else:
739  raise RuntimeError("Unknown object passed as crosstalk sources.",
740  type(crosstalkSources[0]))
741 
742  for detName in crosstalk.interChip:
743  if detName not in sourceNames:
744  self.log.warning("Crosstalk lists %s, not found in sources: %s",
745  detName, sourceNames)
746  continue
747  # Get the coefficients.
748  interChipCoeffs = crosstalk.interChip[detName]
749 
750  sourceExposure = crosstalkSources[sourceNames.index(detName)]
751  if isinstance(sourceExposure, lsst.daf.butler.DeferredDatasetHandle):
752  # Dereference the dafButler.DeferredDatasetHandle.
753  sourceExposure = sourceExposure.get()
754  if not isinstance(sourceExposure, lsst.afw.image.Exposure):
755  raise RuntimeError("Unknown object passed as crosstalk sources.",
756  type(sourceExposure))
757 
758  self.log.info("Correcting detector %s with ctSource %s",
759  exposure.getDetector().getName(),
760  sourceExposure.getDetector().getName())
761  crosstalk.subtractCrosstalk(exposure, sourceExposure=sourceExposure,
762  crosstalkCoeffs=interChipCoeffs,
763  minPixelToMask=self.config.minPixelToMask,
764  crosstalkStr=self.config.crosstalkMaskPlane,
765  isTrimmed=isTrimmed,
766  backgroundMethod=self.config.crosstalkBackgroundMethod)
767  else:
768  self.log.warning("Crosstalk contains interChip coefficients, but no sources found!")
769 
770 
table::Key< int > type
Definition: Detector.cc:163
A class to contain the data, WCS, and other information needed to describe an image of the sky.
Definition: Exposure.h:72
std::string const & getName() const noexcept
Return a filter's name.
Definition: Filter.h:78

Member Data Documentation

◆ ConfigClass

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

Definition at line 661 of file crosstalk.py.


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