I have a calexp and a source catalog from that calexp.
How do I
Overplot the footprints as an overlay in ds9?
Generate a version of the calexp image with the source models subtracted?
An image array representing this would be fine. It doesn’t have to be a formally persisted format.
Note, I’m somewhat familiar with the debugging/visualizion tools from the debug options when running processCcd-type analysis. I’m asking about the post-facto case.
I’m afraid there’s nothing high-level for either of these cases.
For Footprints, there’s some good low-level code you can build on top of: you can either put the Footprints in the Mask plane using afw.detection.setMaskFromFootprint, or use afw.display.drawFootprint to draw the individual spans as regions. The latter is a bit easier to use and provides more source-by-source control, but it also tends to obscure a bit of the image.
As for source models, there’s no single model for each object, and the path to plotting any of them is pretty involved:
There are the deblended HeavyFootprints, which do have utilities to add and remove them from images. But just removing these from the image won’t tell you about the pixels used to make the measurements, because we actually replace them with noise instead of just subtracting them. You might be able to use meas.base.NoiseReplacer to do that, but it wasn’t designed for interactive visualization and hence it might be a bit clunky, especially if you want to reconstruct the noise with the same random seeds as was used in the original processing.
You can subtract each object as if it’s a point source. You can just use Psf.computeImage to get a PSF image you can subtract at each point.
If you’ve run the modelfit_CModel algorithm, you can subtract galaxy models with a bit more effort. But I suspect you haven’t run it, since I happen to know it’s not quite working right now.
To expand Jim’s first point, you want something like
import lsst.afw.display as afwDisplay
import lsst.afw.display.utils as afwDisplayUtils
afwDisplay.setBackend('x11')
disp = afwDisplay.Display(frame=1)
exp = butler.get("calexp", dataId)
srcs = butler.get("src", dataId)
disp.mtv(calexp)
with afwDisplay.Buffering():
for s in srcs:
afwDisplayUtils.drawFootprin(s.getFootprint(), display=disp, peaks=True)
(untested, I’m afraid). I’m a bit surprised that you need to do this as the mask should already be set to show most of the same information.
There should be a notebook illustrating this, but I don’t know of a stand-alone example.