346def drawBBox(bbox, borderWidth=0.0, origin=None, display="deferToFrame", ctype=None, bin=1, frame=None):
347 """Draw a bounding box on a display frame with the specified ctype.
351 bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
353 borderWidth : `float`
354 Include this many pixels
356 If specified, the box is shifted by ``origin``
359 The desired color, either e.g. `lsst.afw.display.RED` or a color name known to X11
361 All BBox coordinates are divided by bin, as is right and proper for overlaying on a binned image
364 x0, y0 = bbox.getMinX(), bbox.getMinY()
365 x1, y1 = bbox.getMaxX(), bbox.getMaxY()
379 display = _getDisplayFromDisplayOrFrame(display, frame)
380 display.line([(x0 - borderWidth, y0 - borderWidth),
381 (x0 - borderWidth, y1 + borderWidth),
382 (x1 + borderWidth, y1 + borderWidth),
383 (x1 + borderWidth, y0 - borderWidth),
384 (x0 - borderWidth, y0 - borderWidth),
388def drawFootprint(foot, borderWidth=0.5, origin=None, XY0=None, frame=None, ctype=None, bin=1,
389 peaks=False, symb="+", size=0.4, ctypePeak=None, display="deferToFrame"):
390 """Draw an `lsst.afw.detection.Footprint` on a display frame with the specified ctype.
394 foot : `lsst.afw.detection.Footprint`
395 borderWidth : `float`
396 Include an extra borderWidth pixels
398 If ``origin`` is present, it's arithmetically added to the Footprint
400 if ``XY0`` is present is subtracted from the Footprint
403 The desired color, either e.g. `lsst.afw.display.RED` or a color name known to X11
405 All Footprint coordinates are divided by bin, as is right and proper
406 for overlaying on a binned image
408 If peaks is `True`, also show the object's Peaks using the specified
409 ``symb`` and ``size`` and ``ctypePeak``
413 The desired color for peaks, either e.g. `lsst.afw.display.RED` or a color name known to X11
419 raise RuntimeError(
"You may not specify both origin and XY0")
420 origin = (-XY0[0], -XY0[1])
422 display = _getDisplayFromDisplayOrFrame(display, frame)
423 with display.Buffering():
425 for s
in foot.getSpans():
426 y, x0, x1 = s.getY(), s.getX0(), s.getX1()
437 display.line([(x0 - borderWidth, y - borderWidth),
438 (x0 - borderWidth, y + borderWidth),
439 (x1 + borderWidth, y + borderWidth),
440 (x1 + borderWidth, y - borderWidth),
441 (x0 - borderWidth, y - borderWidth),
445 for p
in foot.getPeaks():
446 x, y = p.getIx(), p.getIy()
455 display.dot(symb, x, y, size=size, ctype=ctypePeak)
459 """Draw the bounding boxes of input exposures to a coadd on a display
460 frame with the specified ctype, assuming ``display.mtv()`` has already been
461 called on the given exposure on this frame.
463 All coordinates are divided by ``bin``, as is right and proper for overlaying on a binned image
465 coaddWcs = exposure.getWcs()
466 catalog = exposure.getInfo().getCoaddInputs().ccds
470 display = _getDisplayFromDisplayOrFrame(display, frame)
472 with display.Buffering():
473 for record
in catalog:
475 ccdCorners = ccdBox.getCorners()
476 coaddCorners = [coaddWcs.skyToPixel(record.getWcs().pixelToSky(point)) + offset
477 for point
in ccdCorners]
478 display.line([(coaddCorners[i].getX()/bin, coaddCorners[i].getY()/bin)
479 for i
in range(-1, 4)], ctype=ctype)
drawFootprint(foot, borderWidth=0.5, origin=None, XY0=None, frame=None, ctype=None, bin=1, peaks=False, symb="+", size=0.4, ctypePeak=None, display="deferToFrame")