lsst.jointcal  16.0-3-g21cc1d5+2
jointcalCoadd.py
Go to the documentation of this file.
1 # See COPYRIGHT file at the top of the source tree.
2 from lsst.pipe.tasks.makeCoaddTempExp import MakeCoaddTempExpTask
3 from lsst.pipe.base import Struct
4 
5 __all__ = ["JointcalCoaddTaskConfig", "JointcalCoaddTask"]
6 
7 
8 class JointcalCoaddTaskConfig(MakeCoaddTempExpTask.ConfigClass):
9  """Config for JointcalCoaddTask
10  """
11  def setDefaults(self):
12  MakeCoaddTempExpTask.ConfigClass.setDefaults(self)
13  self.doApplyUberCal = True
14 
15 
16 class JointcalCoaddTask(MakeCoaddTempExpTask):
17 
18  ConfigClass = JointcalCoaddTaskConfig
19 
20  def getCalExp(self, dataRef, bgSubtracted):
21  """Return one "calexp" calibrated exposure
22 
23  Parameters
24  ----------
25  dataRef
26  a sensor-level data reference
27  bgSubtracted
28  return calexp with background subtracted? If False get the
29  calexp's background background model and add it to the calexp.
30 
31  Returns
32  -------
33  afw.image.ExposureF
34  The calibrated exposure. If config.doApplyUberCal, jointcal
35  calibrations will be applied to the returned exposure using
36  applyMosaicResults.
37  """
38  exposure = dataRef.get("calexp")
39 
40  if not bgSubtracted:
41  background = dataRef.get("calexpBackground")
42  mi = exposure.getMaskedImage()
43  mi += background.getImage()
44  del mi
45  if not self.config.doApplyUberCal:
46  return exposure
47  # if we are here, it means that we have to apply the improved calibrations coming from jointcal
48  self.log.info("doApplyUberCal is set - Using jointcal updated calibrations")
49  self.applyJointcalResultsExposure(dataRef, calexp=exposure)
50  return exposure
51 
52  def applyJointcalResultsExposure(self, dataRef, calexp=None):
53  """Update an Exposure with the Wcs, from meas_jointcal
54  (Calib and flux sacling will be also used later).
55  If None, the calexp will be loaded from the dataRef. Otherwise it is
56  updated in-place.
57  """
58  if calexp is None:
59  calexp = dataRef.get("calexp")
60 
61  wcsCont = dataRef.get("jointcal_wcs")
62  calexp.setWcs(wcsCont)
63 
64  return Struct(exposure=calexp)
def getCalExp(self, dataRef, bgSubtracted)
def applyJointcalResultsExposure(self, dataRef, calexp=None)