LSST Applications g0b6bd0c080+a72a5dd7e6,g1182afd7b4+2a019aa3bb,g17e5ecfddb+2b8207f7de,g1d67935e3f+06cf436103,g38293774b4+ac198e9f13,g396055baef+6a2097e274,g3b44f30a73+6611e0205b,g480783c3b1+98f8679e14,g48ccf36440+89c08d0516,g4b93dc025c+98f8679e14,g5c4744a4d9+a302e8c7f0,g613e996a0d+e1c447f2e0,g6c8d09e9e7+25247a063c,g7271f0639c+98f8679e14,g7a9cd813b8+124095ede6,g9d27549199+a302e8c7f0,ga1cf026fa3+ac198e9f13,ga32aa97882+7403ac30ac,ga786bb30fb+7a139211af,gaa63f70f4e+9994eb9896,gabf319e997+ade567573c,gba47b54d5d+94dc90c3ea,gbec6a3398f+06cf436103,gc6308e37c7+07dd123edb,gc655b1545f+ade567573c,gcc9029db3c+ab229f5caf,gd01420fc67+06cf436103,gd877ba84e5+06cf436103,gdb4cecd868+6f279b5b48,ge2d134c3d5+cc4dbb2e3f,ge448b5faa6+86d1ceac1d,gecc7e12556+98f8679e14,gf3ee170dca+25247a063c,gf4ac96e456+ade567573c,gf9f5ea5b4d+ac198e9f13,gff490e6085+8c2580be5c,w.2022.27
LSST Data Management Base Package
Functions | Variables
lsst.meas.algorithms.psfSelectionFromMatchList Namespace Reference

Functions

def selectPsfSources (exposure, matches, psfPolicy)
 

Variables

list args = [None, "MatchList", None]
 

Function Documentation

◆ selectPsfSources()

def lsst.meas.algorithms.psfSelectionFromMatchList.selectPsfSources (   exposure,
  matches,
  psfPolicy 
)
Get a list of suitable stars to construct a PSF.

Definition at line 32 of file psfSelectionFromMatchList.py.

32def selectPsfSources(exposure, matches, psfPolicy):
33 """Get a list of suitable stars to construct a PSF."""
34
35 import lsstDebug
36 display = lsstDebug.Info(__name__).display
37 displayExposure = lsstDebug.Info(__name__).displayExposure # display the Exposure + spatialCells
38 #
39 # Unpack policy
40 #
41 kernelSize = psfPolicy.get("kernelSize")
42 borderWidth = psfPolicy.get("borderWidth")
43 sizePsfCellX = psfPolicy.get("sizeCellX")
44 sizePsfCellY = psfPolicy.get("sizeCellY")
45 #
46 mi = exposure.getMaskedImage()
47
48 if display and displayExposure:
49 disp = afwDisplay.Display(frame=0)
50 disp.mtv(mi, title="PSF candidates")
51
52 psfCellSet = afwMath.SpatialCellSet(mi.getBBox(), sizePsfCellX, sizePsfCellY)
53 psfStars = []
54
55 for val in matches:
56 ref, source = val[0:2]
57 if not (ref.getFlagForDetection() & measAlg.Flags.STAR) or \
58 (source.getFlagForDetection() & measAlg.Flags.BAD):
59 continue
60
61 try:
62 cand = measAlg.makePsfCandidate(source, mi)
63 #
64 # The setXXX methods are class static, but it's convenient to call them on
65 # an instance as we don't know Exposure's pixel type (and hence cand's exact type)
66 if cand.getWidth() == 0:
67 cand.setBorderWidth(borderWidth)
68 cand.setWidth(kernelSize + 2*borderWidth)
69 cand.setHeight(kernelSize + 2*borderWidth)
70
71 im = cand.getMaskedImage().getImage()
72 max = afwMath.makeStatistics(im, afwMath.MAX).getValue()
73 if not np.isfinite(max):
74 continue
75
76 psfCellSet.insertCandidate(cand)
77
78 if display and displayExposure:
79 disp.dot("+", source.getXAstrom() - mi.getX0(), source.getYAstrom() - mi.getY0(),
80 size=4, ctype=afwDisplay.CYAN)
81 disp.dot("o", source.getXAstrom() - mi.getX0(), source.getYAstrom() - mi.getY0(),
82 size=4, ctype=afwDisplay.CYAN)
83 except Exception:
84 continue
85
86 source.setFlagForDetection(source.getFlagForDetection() | measAlg.Flags.STAR)
87 psfStars += [source]
88
89 return psfStars, psfCellSet
A collection of SpatialCells covering an entire image.
Definition: SpatialCell.h:383
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Handle a watered-down front-end to the constructor (no variance)
Definition: Statistics.h:359

Variable Documentation

◆ args

list lsst.meas.algorithms.psfSelectionFromMatchList.args = [None, "MatchList", None]

Definition at line 29 of file psfSelectionFromMatchList.py.