LSST Applications g0265f82a02+093ff98f47,g02d81e74bb+3975d4ac1c,g2079a07aa2+14824f138e,g2bbee38e9b+093ff98f47,g337abbeb29+093ff98f47,g3ddfee87b4+626790451e,g3e7165581c+1687b54203,g487adcacf7+018f045a06,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g568d43a26c+02eca3db7e,g591dd9f2cf+3cba9d5141,g858d7b2824+3975d4ac1c,g8a8a8dda67+a6fc98d2e7,g8cdfe0ae6a+66d966b544,g99cad8db69+948283481e,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga2e4dd1c03+626790451e,ga8c6da7877+c38891e457,gae46bcf261+093ff98f47,gb0e22166c9+3863383f4c,gba4ed39666+9664299f35,gbb8dafda3b+dce3423368,gbeb006f7da+65b42827f3,gbf5cecdb8a+3975d4ac1c,gc0f3af6251+39f4c7265c,gc120e1dc64+1d31f3ee8b,gc28159a63d+093ff98f47,gcf0d15dbbd+626790451e,gd2a12a3803+bbf96b9899,gdaeeff99f8+a38ce5ea23,ge79ae78c31+093ff98f47,gee10cc3b42+a6fc98d2e7,gf1cff7945b+3975d4ac1c,v24.1.5.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Attributes | List of all members
lsst.pipe.tasks.snapCombine.SnapCombineTask Class Reference
Inheritance diagram for lsst.pipe.tasks.snapCombine.SnapCombineTask:

Public Member Functions

 __init__ (self, *args, **kwargs)
 
 run (self, snap0, snap1)
 

Static Public Attributes

 ConfigClass = SnapCombineConfig
 

Protected Member Functions

 _add_snaps (self, snap0, snap1)
 
 _merge_visit_info (self, info0, info1)
 

Static Protected Attributes

str _DefaultName = "snapCombine"
 

Detailed Description

Combine two snaps into a single visit image.

Definition at line 40 of file snapCombine.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.pipe.tasks.snapCombine.SnapCombineTask.__init__ ( self,
* args,
** kwargs )

Definition at line 47 of file snapCombine.py.

47 def __init__(self, *args, **kwargs):
48 pipeBase.Task.__init__(self, *args, **kwargs)
49

Member Function Documentation

◆ _add_snaps()

lsst.pipe.tasks.snapCombine.SnapCombineTask._add_snaps ( self,
snap0,
snap1 )
protected
Add two snap exposures together, returning a new exposure.

Parameters
----------
snap0 : `lsst.afw.image.Exposure`
    Snap exposure 0.
snap1 : `lsst.afw.image.Exposure`
    Snap exposure 1.

Returns
-------
combined : `lsst.afw.image.Exposure`
    Combined exposure.

Definition at line 76 of file snapCombine.py.

76 def _add_snaps(self, snap0, snap1):
77 """Add two snap exposures together, returning a new exposure.
78
79 Parameters
80 ----------
81 snap0 : `lsst.afw.image.Exposure`
82 Snap exposure 0.
83 snap1 : `lsst.afw.image.Exposure`
84 Snap exposure 1.
85
86 Returns
87 -------
88 combined : `lsst.afw.image.Exposure`
89 Combined exposure.
90 """
91 combined = snap0.Factory(snap0, True)
92 combined.maskedImage.set(0)
93
94 weights = combined.maskedImage.image.Factory(combined.maskedImage.getBBox())
95 weight = 1.0
96 bad_mask = afwImage.Mask.getPlaneBitMask(self.config.bad_mask_planes)
97 addToCoadd(combined.maskedImage, weights, snap0.maskedImage, bad_mask, weight)
98 addToCoadd(combined.maskedImage, weights, snap1.maskedImage, bad_mask, weight)
99
100 # pre-scaling the weight map instead of post-scaling the combined.maskedImage saves a bit of time
101 # because the weight map is a simple Image instead of a MaskedImage
102 weights *= 0.5 # so result is sum of both images, instead of average
103 combined.maskedImage /= weights
104 setCoaddEdgeBits(combined.maskedImage.getMask(), weights)
105
106 combined.info.setVisitInfo(self._merge_visit_info(snap0.visitInfo, snap1.visitInfo))
107
108 return combined
109

◆ _merge_visit_info()

lsst.pipe.tasks.snapCombine.SnapCombineTask._merge_visit_info ( self,
info0,
info1 )
protected
Merge the visitInfo values from the two exposures.

In particular:
 * id will be the id of snap 0.
 * date will be the average of the dates.
 * exposure time will be the sum of the times.

Parameters
----------
info0, info1 : `lsst.afw.image.VisitInfo`
    Metadata to combine.

Returns
-------
info : `lsst.afw.image.VisitInfo`
    Combined metadata.

Definition at line 110 of file snapCombine.py.

110 def _merge_visit_info(self, info0, info1):
111 """Merge the visitInfo values from the two exposures.
112
113 In particular:
114 * id will be the id of snap 0.
115 * date will be the average of the dates.
116 * exposure time will be the sum of the times.
117
118 Parameters
119 ----------
120 info0, info1 : `lsst.afw.image.VisitInfo`
121 Metadata to combine.
122
123 Returns
124 -------
125 info : `lsst.afw.image.VisitInfo`
126 Combined metadata.
127
128 """
129 time = info0.exposureTime + info1.exposureTime
130 date = (info0.date.get() + info1.date.get()) / 2.0
131 result = info0.copyWith(exposureTime=time,
132 date=dafBase.DateTime(date)
133 )
134 return result
Class for handling dates/times, including MJD, UTC, and TAI.
Definition DateTime.h:64

◆ run()

lsst.pipe.tasks.snapCombine.SnapCombineTask.run ( self,
snap0,
snap1 )
Combine two snaps, returning the combined image.

Parameters
----------
snap0 : `lsst.afw.image.Exposure`
    Snapshot exposure 0.
snap1 : `lsst.afw.image.Exposure`
    Snapshot exposure 1.

Returns
-------
result : `lsst.pipe.base.Struct`
    Results as a struct with attributes:

    ``exposure``
        Snap-combined exposure.

Definition at line 51 of file snapCombine.py.

51 def run(self, snap0, snap1):
52 """Combine two snaps, returning the combined image.
53
54 Parameters
55 ----------
56 snap0 : `lsst.afw.image.Exposure`
57 Snapshot exposure 0.
58 snap1 : `lsst.afw.image.Exposure`
59 Snapshot exposure 1.
60
61 Returns
62 -------
63 result : `lsst.pipe.base.Struct`
64 Results as a struct with attributes:
65
66 ``exposure``
67 Snap-combined exposure.
68 """
69 self.log.info("Merging two snaps with exposure ids: %s, %s", snap0.visitInfo.id, snap1.visitInfo.id)
70 combined = self._add_snaps(snap0, snap1)
71
72 return pipeBase.Struct(
73 exposure=combined,
74 )
75

Member Data Documentation

◆ _DefaultName

str lsst.pipe.tasks.snapCombine.SnapCombineTask._DefaultName = "snapCombine"
staticprotected

Definition at line 45 of file snapCombine.py.

◆ ConfigClass

lsst.pipe.tasks.snapCombine.SnapCombineTask.ConfigClass = SnapCombineConfig
static

Definition at line 44 of file snapCombine.py.


The documentation for this class was generated from the following file: