LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
makeCoaddApCorrMap.py
Go to the documentation of this file.
1 from lsst.afw.image import ApCorrMap
2 from .algorithmsLib import CoaddBoundedField, CoaddBoundedFieldElement
3 
4 __all__ = ["makeCoaddApCorrMap",]
5 
6 def makeCoaddApCorrMap(catalog, coaddBox, coaddWcs, weightFieldName="weight"):
7  """Construct an ApCorrMap for a coadd
8 
9  @param catalog: Table of coadd inputs (lsst.afw.table.ExposureCatalog)
10  @param coaddBox: Bounding box for coadd (lsst.afw.geom.Box2I)
11  @param coaddWcs: Wcs for coadd
12  @param weightFieldName: name of weight field in catalog
13  @return aperture corrections
14  """
15 
16  # Assemble the BoundedFields for each type
17  everything = {} # name --> list of CoaddBoundedFieldElement
18  weightKey = catalog.schema[weightFieldName].asKey()
19  for row in catalog:
20  apCorrMap = row.getApCorrMap()
21  if not apCorrMap:
22  continue
23  weight = row.get(weightKey)
24  wcs = row.getWcs()
25  validPolygon = row.getValidPolygon()
26  for name, bf in apCorrMap.items():
27  if not name in everything:
28  everything[name] = []
29  everything[name].append(CoaddBoundedFieldElement(bf, wcs, validPolygon, weight))
30 
31  # Construct a CoaddBoundedField for each type
32  apCorrMap = ApCorrMap()
33  for name, elements in everything.iteritems():
34  apCorrMap.set(name, CoaddBoundedField(coaddBox, coaddWcs, elements))
35 
36  return apCorrMap
Struct used to hold one Exposure's data in a CoaddBoundedField.
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:42