27 args = [
None,
"MatchList",
None]
30 """Get a list of suitable stars to construct a PSF."""
38 kernelSize = psfPolicy.get(
"kernelSize")
39 borderWidth = psfPolicy.get(
"borderWidth")
40 sizePsfCellX = psfPolicy.get(
"sizeCellX")
41 sizePsfCellY = psfPolicy.get(
"sizeCellY")
43 mi = exposure.getMaskedImage()
45 if display
and displayExposure:
47 ds9.mtv(mi, frame=frame, title=
"PSF candidates")
53 ref, source = val[0:2]
54 if not (ref.getFlagForDetection() & measAlg.Flags.STAR)
or \
55 (source.getFlagForDetection() & measAlg.Flags.BAD):
63 if cand.getWidth() == 0:
64 cand.setBorderWidth(borderWidth)
65 cand.setWidth(kernelSize + 2*borderWidth)
66 cand.setHeight(kernelSize + 2*borderWidth)
68 im = cand.getMaskedImage().getImage()
70 if not numpy.isfinite(max):
73 psfCellSet.insertCandidate(cand)
75 if display
and displayExposure:
76 ds9.dot(
"+", source.getXAstrom() - mi.getX0(), source.getYAstrom() - mi.getY0(),
77 size=4, frame=frame, ctype=ds9.CYAN)
78 ds9.dot(
"o", source.getXAstrom() - mi.getX0(), source.getYAstrom() - mi.getY0(),
79 size=4, frame=frame, ctype=ds9.CYAN)
83 source.setFlagForDetection(source.getFlagForDetection() | measAlg.Flags.STAR)
86 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.