lsst.jointcal  14.0-17-ge3cc87b+1
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 
9 class JointcalCoaddTaskConfig(MakeCoaddTempExpTask.ConfigClass):
10  """Config for JointcalCoaddTask
11  """
12  def setDefaults(self):
13  MakeCoaddTempExpTask.ConfigClass.setDefaults(self)
14  self.doApplyUberCal = True
15 
16 
17 class JointcalCoaddTask(MakeCoaddTempExpTask):
18 
19  ConfigClass = JointcalCoaddTaskConfig
20 
21  def getCalExp(self, dataRef, bgSubtracted):
22  """!Return one "calexp" calibrated exposure
23 
24  @param[in] dataRef a sensor-level data reference
25  @param[in] bgSubtracted return calexp with background subtracted? If False get the
26  calexp's background background model and add it to the calexp.
27  @return calibrated exposure
28 
29  If config.doApplyUberCal, meas_mosaic calibrations will be applied to
30  the returned exposure using applyMosaicResults.
31  """
32  exposure = dataRef.get("calexp")
33 
34  if not bgSubtracted:
35  background = dataRef.get("calexpBackground")
36  mi = exposure.getMaskedImage()
37  mi += background.getImage()
38  del mi
39  if not self.config.doApplyUberCal:
40  return exposure
41  # if we are here, it means that we have to apply the improved calibrations coming from jointcal
42  self.log.info("doApplyUberCal is set - Using jointcal updated calibrations")
43  self.applyJointcalResultsExposure(dataRef, calexp=exposure)
44  return exposure
45 
46  def applyJointcalResultsExposure(self, dataRef, calexp=None):
47  """Update an Exposure with the Wcs, from meas_jointcal
48  (Calib and flux sacling will be also used later).
49  If None, the calexp will be loaded from the dataRef. Otherwise it is
50  updated in-place.
51  """
52  if calexp is None:
53  calexp = dataRef.get("calexp")
54 
55  wcsCont = dataRef.get("wcs")
56  calexp.setWcs(wcsCont.getWcs())
57 
58  return Struct(exposure=calexp)
def getCalExp(self, dataRef, bgSubtracted)
Return one "calexp" calibrated exposure.
def applyJointcalResultsExposure(self, dataRef, calexp=None)