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.pipe.drivers.constructCalibs.CalibCombineTask Class Reference
Inheritance diagram for lsst.pipe.drivers.constructCalibs.CalibCombineTask:

Public Member Functions

def __init__ (self, *args, **kwargs)
 
def run (self, sensorRefList, expScales=None, finalScale=None, inputName="postISRCCD")
 Combine calib images for a single sensor. More...
 
def getDimensions (self, sensorRefList, inputName="postISRCCD")
 
def applyScale (self, exposure, scale=None)
 
def combine (self, target, imageList, stats)
 Combine multiple images. More...
 

Static Public Attributes

 ConfigClass = CalibCombineConfig
 

Detailed Description

Task to combine calib images

Definition at line 91 of file constructCalibs.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.drivers.constructCalibs.CalibCombineTask.__init__ (   self,
args,
**  kwargs 
)

Definition at line 95 of file constructCalibs.py.

95  def __init__(self, *args, **kwargs):
96  Task.__init__(self, *args, **kwargs)
97  self.makeSubtask("stats")
98 

Member Function Documentation

◆ applyScale()

def lsst.pipe.drivers.constructCalibs.CalibCombineTask.applyScale (   self,
  exposure,
  scale = None 
)
Apply scale to input exposure

This implementation applies a flux scaling: the input exposure is
divided by the provided scale.

Definition at line 155 of file constructCalibs.py.

155  def applyScale(self, exposure, scale=None):
156  """Apply scale to input exposure
157 
158  This implementation applies a flux scaling: the input exposure is
159  divided by the provided scale.
160  """
161  if scale is not None:
162  mi = exposure.getMaskedImage()
163  mi /= scale
164 

◆ combine()

def lsst.pipe.drivers.constructCalibs.CalibCombineTask.combine (   self,
  target,
  imageList,
  stats 
)

Combine multiple images.

    @param target      Target image to receive the combined pixels
    @param imageList   List of input images
    @param stats       Statistics control

Definition at line 165 of file constructCalibs.py.

165  def combine(self, target, imageList, stats):
166  """!Combine multiple images
167 
168  @param target Target image to receive the combined pixels
169  @param imageList List of input images
170  @param stats Statistics control
171  """
172  images = [img for img in imageList if img is not None]
173  afwMath.statisticsStack(target, images, afwMath.Property(self.config.combine), stats)
174 
175 
Property
control what is calculated
Definition: Statistics.h:62
std::shared_ptr< lsst::afw::image::Image< PixelT > > statisticsStack(std::vector< std::shared_ptr< lsst::afw::image::Image< PixelT >>> &images, Property flags, StatisticsControl const &sctrl=StatisticsControl(), std::vector< lsst::afw::image::VariancePixel > const &wvector=std::vector< lsst::afw::image::VariancePixel >(0))
A function to compute some statistics of a stack of Images.

◆ getDimensions()

def lsst.pipe.drivers.constructCalibs.CalibCombineTask.getDimensions (   self,
  sensorRefList,
  inputName = "postISRCCD" 
)
Get dimensions of the inputs

Definition at line 145 of file constructCalibs.py.

145  def getDimensions(self, sensorRefList, inputName="postISRCCD"):
146  """Get dimensions of the inputs"""
147  dimList = []
148  for sensorRef in sensorRefList:
149  if sensorRef is None:
150  continue
151  md = sensorRef.get(inputName + "_md")
152  dimList.append(afwImage.bboxFromMetadata(md).getDimensions())
153  return getSize(dimList)
154 
lsst::geom::Box2I bboxFromMetadata(daf::base::PropertySet &metadata)
Determine the image bounding box from its metadata (FITS header)
Definition: Image.cc:680

◆ run()

def lsst.pipe.drivers.constructCalibs.CalibCombineTask.run (   self,
  sensorRefList,
  expScales = None,
  finalScale = None,
  inputName = "postISRCCD" 
)

Combine calib images for a single sensor.

    @param sensorRefList   List of data references to combine (for a single sensor)
    @param expScales       List of scales to apply for each exposure
    @param finalScale      Desired scale for final combined image
    @param inputName       Data set name for inputs
    @return combined image

Definition at line 99 of file constructCalibs.py.

99  def run(self, sensorRefList, expScales=None, finalScale=None, inputName="postISRCCD"):
100  """!Combine calib images for a single sensor
101 
102  @param sensorRefList List of data references to combine (for a single sensor)
103  @param expScales List of scales to apply for each exposure
104  @param finalScale Desired scale for final combined image
105  @param inputName Data set name for inputs
106  @return combined image
107  """
108  width, height = self.getDimensions(sensorRefList)
109  stats = afwMath.StatisticsControl(self.config.clip, self.config.nIter,
110  afwImage.Mask.getPlaneBitMask(self.config.mask))
111  numImages = len(sensorRefList)
112  if numImages < 1:
113  raise RuntimeError("No valid input data")
114  if numImages < self.config.stats.maxVisitsToCalcErrorFromInputVariance:
115  stats.setCalcErrorFromInputVariance(True)
116 
117  # Combine images
118  combined = afwImage.MaskedImageF(width, height)
119  imageList = [None]*numImages
120  for start in range(0, height, self.config.rows):
121  rows = min(self.config.rows, height - start)
122  box = geom.Box2I(geom.Point2I(0, start),
123  geom.Extent2I(width, rows))
124  subCombined = combined.Factory(combined, box)
125 
126  for i, sensorRef in enumerate(sensorRefList):
127  if sensorRef is None:
128  imageList[i] = None
129  continue
130  exposure = sensorRef.get(inputName + "_sub", bbox=box)
131  if expScales is not None:
132  self.applyScale(exposure, expScales[i])
133  imageList[i] = exposure.getMaskedImage()
134 
135  self.combine(subCombined, imageList, stats)
136 
137  if finalScale is not None:
138  background = self.stats.run(combined)
139  self.log.info("%s: Measured background of stack is %f; adjusting to %f" %
140  (NODE, background, finalScale))
141  combined *= finalScale / background
142 
143  return combined
144 
int min
Pass parameters to a Statistics object.
Definition: Statistics.h:92
An integer coordinate rectangle.
Definition: Box.h:55
def run(self, coaddExposures, bbox, wcs)
Definition: getTemplate.py:603

Member Data Documentation

◆ ConfigClass

lsst.pipe.drivers.constructCalibs.CalibCombineTask.ConfigClass = CalibCombineConfig
static

Definition at line 93 of file constructCalibs.py.


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