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