29def makeCoaddApCorrMap(catalog, coaddBox, coaddWcs, weightFieldName="weight"):
30 """Construct an ApCorrMap for a coadd
34 catalog: `lsst.afw.table.ExposureCatalog`
35 A table of coadd inputs
36 coaddBox : `lsst.geom.Box2I`
37 Bounding box for coadd
38 coaddWcs : `lsst.afw.geom.SkyWcs`
40 weightFieldName : `str`
41 Name of the weight field in the catalog
45 apCorrMap : `lsst.afw.image.ApCorrMap`
51 weightKey = catalog.schema[weightFieldName].asKey()
53 apCorrMap = row.getApCorrMap()
56 weight = row.get(weightKey)
58 validPolygon = row.getValidPolygon()
59 for name, bf
in apCorrMap.items():
60 if name
not in everything:
62 everything[name].append(CoaddBoundedFieldElement(bf, wcs, validPolygon, weight))
66 for name, elements
in everything.items():
67 apCorrMap.set(name, CoaddBoundedField(coaddBox, coaddWcs, elements))