Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

# See COPYRIGHT file at the top of the source tree. 

from lsst.pipe.tasks.makeCoaddTempExp import MakeCoaddTempExpTask 

from lsst.pipe.base import Struct 

 

__all__ = ["JointcalCoaddTaskConfig", "JointcalCoaddTask"] 

 

 

class JointcalCoaddTaskConfig(MakeCoaddTempExpTask.ConfigClass): 

"""Config for JointcalCoaddTask 

""" 

def setDefaults(self): 

MakeCoaddTempExpTask.ConfigClass.setDefaults(self) 

self.doApplyUberCal = True 

 

 

class JointcalCoaddTask(MakeCoaddTempExpTask): 

 

ConfigClass = JointcalCoaddTaskConfig 

 

def getCalExp(self, dataRef, bgSubtracted): 

"""Return one "calexp" calibrated exposure 

 

Parameters 

---------- 

dataRef 

a sensor-level data reference 

bgSubtracted 

return calexp with background subtracted? If False get the 

calexp's background background model and add it to the calexp. 

 

Returns 

------- 

afw.image.ExposureF 

The calibrated exposure. If config.doApplyUberCal, jointcal 

calibrations will be applied to the returned exposure using 

applyMosaicResults. 

""" 

exposure = dataRef.get("calexp") 

 

if not bgSubtracted: 

background = dataRef.get("calexpBackground") 

mi = exposure.getMaskedImage() 

mi += background.getImage() 

del mi 

if not self.config.doApplyUberCal: 

return exposure 

# if we are here, it means that we have to apply the improved calibrations coming from jointcal 

self.log.info("doApplyUberCal is set - Using jointcal updated calibrations") 

self.applyJointcalResultsExposure(dataRef, calexp=exposure) 

return exposure 

 

def applyJointcalResultsExposure(self, dataRef, calexp=None): 

"""Update an Exposure with the Wcs, from meas_jointcal 

(Calib and flux sacling will be also used later). 

If None, the calexp will be loaded from the dataRef. Otherwise it is 

updated in-place. 

""" 

if calexp is None: 

calexp = dataRef.get("calexp") 

 

wcsCont = dataRef.get("jointcal_wcs") 

calexp.setWcs(wcsCont) 

 

return Struct(exposure=calexp)