31 """Get a list of suitable stars to construct a PSF."""
39 kernelSize = psfPolicy.get(
"kernelSize")
40 borderWidth = psfPolicy.get(
"borderWidth")
41 sizePsfCellX = psfPolicy.get(
"sizeCellX")
42 sizePsfCellY = psfPolicy.get(
"sizeCellY")
44 mi = exposure.getMaskedImage()
46 if display
and displayExposure:
48 ds9.mtv(mi, frame=frame, title=
"PSF candidates")
54 ref, source = val[0:2]
55 if not (ref.getFlagForDetection() & measAlg.Flags.STAR)
or \
56 (source.getFlagForDetection() & measAlg.Flags.BAD):
64 if cand.getWidth() == 0:
65 cand.setBorderWidth(borderWidth)
66 cand.setWidth(kernelSize + 2*borderWidth)
67 cand.setHeight(kernelSize + 2*borderWidth)
69 im = cand.getMaskedImage().getImage()
71 if not numpy.isfinite(max):
74 psfCellSet.insertCandidate(cand)
76 if display
and displayExposure:
77 ds9.dot(
"+", source.getXAstrom() - mi.getX0(), source.getYAstrom() - mi.getY0(),
78 size=4, frame=frame, ctype=ds9.CYAN)
79 ds9.dot(
"o", source.getXAstrom() - mi.getX0(), source.getYAstrom() - mi.getY0(),
80 size=4, frame=frame, ctype=ds9.CYAN)
84 source.setFlagForDetection(source.getFlagForDetection() | measAlg.Flags.STAR)
87 return psfStars, psfCellSet
boost::shared_ptr< PsfCandidate< PixelT > > makePsfCandidate(boost::shared_ptr< afw::table::SourceRecord > const &source, boost::shared_ptr< afw::image::Exposure< PixelT > > image)
A collection of SpatialCells covering an entire image.
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.