23 from __future__
import absolute_import, division, print_function
24 from builtins
import zip
25 from builtins
import range
26 from matplotlib
import pyplot
32 """Plot the bounding boxes of an observation catalog (see MockCoaddTask.buildObservationCatalog) 33 using matplotlib, in the coordinates defined by the given Wcs (usually a skymap Wcs). 35 for record
in catalog:
36 box = lsst.afw.geom.Box2D(record.getBBox())
39 iWcs = record.getWcs()
40 for xi, yi
in box.getCorners():
42 coord = iWcs.pixelToSky(xi, yi)
43 xo, yo = wcs.skyToPixel(coord)
47 print(
"WARNING: point %d, %d failed" % (xi, yi))
48 pyplot.fill(x, y, facecolor=
'r', alpha=0.1, edgecolor=None) 52 """Plot the patches in a skymap tract using matplotlib. 54 nPatchX, nPatchY = tractInfo.getNumPatches()
55 for iPatchX
in range(nPatchX):
56 for iPatchY
in range(nPatchY):
57 patchInfo = tractInfo.getPatchInfo((iPatchX, iPatchY))
58 xp1, yp1 = list(zip(*patchInfo.getOuterBBox().getCorners()))
59 xp2, yp2 = list(zip(*patchInfo.getInnerBBox().getCorners()))
60 pyplot.fill(xp1, yp1, fill=
False, edgecolor=
'g', linestyle=
'dashed')
61 pyplot.fill(xp2, yp2, fill=
False, edgecolor=
'g')
65 """Plot the objects in a truth catalog as dots using matplotlib, in the coordinate 66 system defined by the given Wcs. 70 for record
in catalog:
71 x, y = wcs.skyToPixel(record.getCoord())
74 pyplot.plot(xp, yp,
'k+')
78 """Display coadd images with DS9 in different frames, with the bounding boxes of the 79 observations that went into them overlayed. 81 import lsst.afw.display.ds9
82 import lsst.afw.display.utils
83 butler = lsst.daf.persistence.Butler(root=root)
84 skyMap = butler.get(
"deepCoadd_skyMap")
87 coadds = [patchRef.get(
"deepCoadd", immediate=
True)
88 for patchRef
in task.iterPatchRefs(butler, tractInfo)]
89 for n, coadd
in enumerate(coadds):
90 lsst.afw.display.ds9.mtv(coadd, frame=n+1)
91 for n, coadd
in enumerate(coadds):
92 lsst.afw.display.utils.drawCoaddInputs(coadd, frame=n+1)
97 """Convenience function to make all matplotlib plots. 100 import lsst.daf.persistence
101 butler = lsst.daf.persistence.Butler(root=root)
102 skyMap = butler.get(
"deepCoadd_skyMap")
103 observations = butler.get(
"observations", tract=0)
104 truth = butler.get(
"truth", tract=0)
105 tractInfo = skyMap[0]
109 pyplot.axis(
"scaled")
def plotObservations(catalog, wcs)
def plotPatches(tractInfo)
def plotTruth(catalog, wcs)