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