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
Functions
lsst.pipe.tasks.mocks.visualization Namespace Reference

Functions

def plotObservations
 
def plotPatches
 
def plotTruth
 
def displayImages
 
def makePlots
 

Function Documentation

def lsst.pipe.tasks.mocks.visualization.displayImages (   root)
Display coadd images with DS9 in different frames, with the bounding boxes of the
observations that went into them overlayed.

Definition at line 70 of file visualization.py.

70 
71 def displayImages(root):
72  """Display coadd images with DS9 in different frames, with the bounding boxes of the
73  observations that went into them overlayed.
74  """
77  butler = lsst.daf.persistence.Butler(root=root)
78  skyMap = butler.get("deepCoadd_skyMap")
79  tractInfo = skyMap[0]
80  task = lsst.pipe.tasks.mocks.MockCoaddTask()
81  coadds = [patchRef.get("deepCoadd", immediate=True)
82  for patchRef in task.iterPatchRefs(butler, tractInfo)]
83  for n, coadd in enumerate(coadds):
84  lsst.afw.display.ds9.mtv(coadd, frame=n+1)
85  for n, coadd in enumerate(coadds):
87  return butler
def lsst.pipe.tasks.mocks.visualization.makePlots (   root)
Convenience function to make all matplotlib plots.

Definition at line 88 of file visualization.py.

88 
89 def makePlots(root):
90  """Convenience function to make all matplotlib plots.
91  """
94  butler = lsst.daf.persistence.Butler(root=root)
95  skyMap = butler.get("deepCoadd_skyMap")
96  observations = butler.get("observations", tract=0)
97  truth = butler.get("truth", tract=0)
98  tractInfo = skyMap[0]
99  plotPatches(tractInfo)
100  plotObservations(observations, tractInfo.getWcs())
101  plotTruth(truth, tractInfo.getWcs())
102  pyplot.axis("scaled")
103  pyplot.show()
104  return butler
def lsst.pipe.tasks.mocks.visualization.plotObservations (   catalog,
  wcs 
)
Plot the bounding boxes of an observation catalog (see MockCoaddTask.buildObservationCatalog)
using matplotlib, in the coordinates defined by the given Wcs (usually a skymap Wcs).

Definition at line 27 of file visualization.py.

27 
28 def plotObservations(catalog, wcs):
29  """Plot the bounding boxes of an observation catalog (see MockCoaddTask.buildObservationCatalog)
30  using matplotlib, in the coordinates defined by the given Wcs (usually a skymap Wcs).
31  """
32  for record in catalog:
33  box = lsst.afw.geom.Box2D(record.getBBox())
34  x = []
35  y = []
36  iWcs = record.getWcs()
37  for xi, yi in box.getCorners():
38  try:
39  coord = iWcs.pixelToSky(xi, yi)
40  xo, yo = wcs.skyToPixel(coord)
41  x.append(xo)
42  y.append(yo)
43  except:
44  print "WARNING: point %d, %d failed" % (xi, yi)
45  pyplot.fill(x, y, facecolor='r', alpha=0.1, edgecolor=None)
A floating-point coordinate rectangle geometry.
Definition: Box.h:271
def lsst.pipe.tasks.mocks.visualization.plotPatches (   tractInfo)
Plot the patches in a skymap tract using matplotlib.

Definition at line 46 of file visualization.py.

46 
47 def plotPatches(tractInfo):
48  """Plot the patches in a skymap tract using matplotlib.
49  """
50  nPatchX, nPatchY = tractInfo.getNumPatches()
51  for iPatchX in range(nPatchX):
52  for iPatchY in range(nPatchY):
53  patchInfo = tractInfo.getPatchInfo((iPatchX, iPatchY))
54  xp1, yp1 = zip(*patchInfo.getOuterBBox().getCorners())
55  xp2, yp2 = zip(*patchInfo.getInnerBBox().getCorners())
56  pyplot.fill(xp1, yp1, fill=False, edgecolor='g', linestyle='dashed')
57  pyplot.fill(xp2, yp2, fill=False, edgecolor='g')
def lsst.pipe.tasks.mocks.visualization.plotTruth (   catalog,
  wcs 
)
Plot the objects in a truth catalog as dots using matplotlib, in the coordinate
system defined by the given Wcs.

Definition at line 58 of file visualization.py.

58 
59 def plotTruth(catalog, wcs):
60  """Plot the objects in a truth catalog as dots using matplotlib, in the coordinate
61  system defined by the given Wcs.
62  """
63  xp = []
64  yp = []
65  for record in catalog:
66  x, y = wcs.skyToPixel(record.getCoord())
67  xp.append(x)
68  yp.append(y)
69  pyplot.plot(xp, yp, 'k+')