2 function to show a list of src footprints in a mosaic
12 from .
import matchFakes
19 make a mosaic for the given source list from the given exposure
21 stolen from psfMosaic.py on the sphinx documentation
23 img = exposure.getMaskedImage().getImage()
27 footBBox = src.getFootprint().getBBox()
28 subimg = lsst.afw.image.ImageF(img, footBBox,
29 lsst.afw.image.PARENT,
True)
30 footMask = lsst.afw.image.ImageU(footBBox)
31 src.getFootprint().insertIntoImage(footMask, 1, footBBox)
32 subimg *= footMask.convertF()
33 subImages.append(subimg)
34 labels.append(
'ID=%s' % str(src.get(idname)))
36 m = afwDisplay.utils.Mosaic()
44 mosaic = m.makeMosaic()
47 disp = afwDisplay.Display()
48 disp.mtv(mosaic, title=
"mosaic")
52 def main(root, visit, ccd, fakes=None, blends=False, listobj=16, filt=None):
55 dataId = {
'visit': visit,
56 'ccd': int(ccd)}
if filt
is None else {
'tract': visit,
61 src = matchFakes.getFakeSources(butler, dataId,
62 extraCols=(
'zeropoint'),
65 src = butler.get(
'src' if filt
is None else 'deepCoadd-src', dataId)
67 src = [s
for s
in src
if ((s.get(
'deblend.nchild') == 0) &
68 (s.get(
'parent') == 0))]
70 src = [s
for s
in src
if (s.get(
'deblend.nchild') == 0)]
72 exposure = butler.get(
'calexp' if filt
is None else 'deepCoadd', dataId)
74 if type(listobj)
is int:
75 listobj = numpy.random.choice(
list(range(len(src))), listobj,
False)
77 srcList = [src[i]
for i
in listobj]
79 getMosaic(srcList, exposure,
'fakeId' if fakes
else 'id')
82 if __name__ ==
'__main__':
83 parser = argparse.ArgumentParser()
84 parser.add_argument(
'root', help=
"Root directory of data repository")
85 parser.add_argument(
"visit", type=int, help=
"Visit or tract")
86 parser.add_argument(
"ccd", type=str, help=
"CCD or patch")
87 parser.add_argument(
'-d',
'--band', default=
None,
88 help=
'HSC filter, used with tract/patch')
89 parser.add_argument(
'-f',
'--fake', default=
None,
90 help=
'show fake sources, using -f as catalog')
91 parser.add_argument(
'-n',
'--number', dest=
'num',
92 help=
'number of objects to show',
94 parser.add_argument(
'-b',
'--blends', action=
'store_true',
95 default=
False, help=
'show blended systems')
97 args = parser.parse_args()
99 main(args.root, args.visit, args.ccd,
100 fakes=args.fake, listobj=args.num,
101 blends=args.blends, filt=args.band)