lsst.meas.algorithms  20.0.0-10-g0891cd99+0a044d1778
makeCoaddApCorrMap.py
Go to the documentation of this file.
1 #
2 # LSST Data Management System
3 #
4 # Copyright 2008-2017 AURA/LSST.
5 #
6 # This product includes software developed by the
7 # LSST Project (http://www.lsst.org/).
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the LSST License Statement and
20 # the GNU General Public License along with this program. If not,
21 # see <https://www.lsstcorp.org/LegalNotices/>.
22 #
23 __all__ = ["makeCoaddApCorrMap", ]
24 
25 from lsst.afw.image import ApCorrMap
26 from .coaddBoundedField import CoaddBoundedField, CoaddBoundedFieldElement
27 
28 
29 def makeCoaddApCorrMap(catalog, coaddBox, coaddWcs, weightFieldName="weight"):
30  """Construct an ApCorrMap for a coadd
31 
32  @param catalog: Table of coadd inputs (lsst.afw.table.ExposureCatalog)
33  @param coaddBox: Bounding box for coadd (lsst.geom.Box2I)
34  @param coaddWcs: Wcs for coadd
35  @param weightFieldName: name of weight field in catalog
36  @return aperture corrections
37  """
38 
39  # Assemble the BoundedFields for each type
40  everything = {} # name --> list of CoaddBoundedFieldElement
41  weightKey = catalog.schema[weightFieldName].asKey()
42  for row in catalog:
43  apCorrMap = row.getApCorrMap()
44  if not apCorrMap:
45  continue
46  weight = row.get(weightKey)
47  wcs = row.getWcs()
48  validPolygon = row.getValidPolygon()
49  for name, bf in apCorrMap.items():
50  if name not in everything:
51  everything[name] = []
52  everything[name].append(CoaddBoundedFieldElement(bf, wcs, validPolygon, weight))
53 
54  # Construct a CoaddBoundedField for each type
55  apCorrMap = ApCorrMap()
56  for name, elements in everything.items():
57  apCorrMap.set(name, CoaddBoundedField(coaddBox, coaddWcs, elements))
58 
59  return apCorrMap
lsst::afw::image
lsst::meas::algorithms.makeCoaddApCorrMap.makeCoaddApCorrMap
def makeCoaddApCorrMap(catalog, coaddBox, coaddWcs, weightFieldName="weight")
Definition: makeCoaddApCorrMap.py:29
lsst::afw::image::ApCorrMap