21 from abc
import ABC, abstractmethod
22 from typing
import Optional
25 from lsst.pipe.base
import Task
27 from .isrFunctions
import checkFilter
31 doRotatorAngleCorrection = Field(
39 doc=
"Filters that need straylight correction.",
45 """Remove stray light from instruments.
47 This is a dummy task to be retargeted with an camera-specific version.
49 ConfigClass = StrayLightConfig
50 _DefaultName =
"isrStrayLight"
53 """Read and return calibration products relevant for correcting
54 stray light in the given exposure.
58 dataRef : `daf.persistence.butlerSubset.ButlerDataRef`
59 Butler reference of the detector data to be processed
60 rawExposure : `afw.image.Exposure`
61 The raw exposure that will later be corrected with the
62 retrieved calibration data; should not be modified in this
67 straylightData : `object`, optional
68 An opaque object that should be passed as the second argument to
69 the `run` method. If `None`, no stray light correction will be
70 performed for the given image. Any other object (e.g. `True`)
71 may be used to signal that stray light correction should be
72 performed even if there is nothing to read.
76 This method will be called only when `IsrTask` is run by the Gen2
77 Middleware (i.e. CmdLineTask).
82 """Check if stray light correction should be run.
86 exposure : `lsst.afw.image.Exposure`
91 def run(self, exposure, strayLightData):
92 """Correct stray light.
96 exposure : `lsst.afw.image.Exposure`
98 strayLightData : `object`, optional
99 An opaque object that contains any calibration data used to
100 correct for stray light.
102 raise NotImplementedError(
"Must be implemented by subclasses.")
105 """Check whether we should fringe-subtract the science exposure.
109 exposure : `lsst.afw.image.Exposure`
110 Exposure to check the filter of.
115 If True, then the exposure has a filter listed in the
116 configuration, and should have the fringe applied.
118 return checkFilter(exposure, self.config.filters, log=self.log)
122 """An abstract base class for rotator-dependent stray light information.
126 def evaluate(self, angle_start: Angle, angle_end: Optional[Angle] =
None):
127 """Get a stray light array for a range of rotator angles.
131 angle_begin : `float`
132 Instrument rotation angle at the start of the exposure.
133 angle_end : `float`, optional
134 Instrument rotation angle at the end of the exposure.
135 If not provided, the returned array will reflect a snapshot at
140 array : `numpy.ndarray`
141 A stray-light background image for this exposure.
143 raise NotImplementedError(
"Must be implemented by subclasses.")
def evaluate(self, Angle angle_start, Optional[Angle] angle_end=None)
def check(self, exposure)
def checkFilter(self, exposure)
def run(self, exposure, strayLightData)
def readIsrData(self, dataRef, rawExposure)