28 args = [
None,
"MatchList",
None]
32 """Get a list of suitable stars to construct a PSF.""" 40 kernelSize = psfPolicy.get(
"kernelSize")
41 borderWidth = psfPolicy.get(
"borderWidth")
42 sizePsfCellX = psfPolicy.get(
"sizeCellX")
43 sizePsfCellY = psfPolicy.get(
"sizeCellY")
45 mi = exposure.getMaskedImage()
47 if display
and displayExposure:
49 ds9.mtv(mi, frame=frame, title=
"PSF candidates")
55 ref, source = val[0:2]
56 if not (ref.getFlagForDetection() & measAlg.Flags.STAR)
or \
57 (source.getFlagForDetection() & measAlg.Flags.BAD):
65 if cand.getWidth() == 0:
66 cand.setBorderWidth(borderWidth)
67 cand.setWidth(kernelSize + 2*borderWidth)
68 cand.setHeight(kernelSize + 2*borderWidth)
70 im = cand.getMaskedImage().getImage()
72 if not numpy.isfinite(max):
75 psfCellSet.insertCandidate(cand)
77 if display
and displayExposure:
78 ds9.dot(
"+", source.getXAstrom() - mi.getX0(), source.getYAstrom() - mi.getY0(),
79 size=4, frame=frame, ctype=ds9.CYAN)
80 ds9.dot(
"o", source.getXAstrom() - mi.getX0(), source.getYAstrom() - mi.getY0(),
81 size=4, frame=frame, ctype=ds9.CYAN)
85 source.setFlagForDetection(source.getFlagForDetection() | measAlg.Flags.STAR)
88 return psfStars, psfCellSet
Fit spatial kernel using approximate fluxes for candidates, and solving a linear system of equations...
def selectPsfSources(exposure, matches, psfPolicy)
Statistics makeStatistics(lsst::afw::math::MaskedVector< EntryT > const &mv, std::vector< WeightPixel > const &vweights, int const flags, StatisticsControl const &sctrl=StatisticsControl())
std::shared_ptr< PsfCandidate< PixelT > > makePsfCandidate(boost::shared_ptr< afw::table::SourceRecord > const &source, boost::shared_ptr< afw::image::Exposure< PixelT > > image)
Return a PsfCandidate of the right sort.