LSST Applications g0265f82a02+c6dfa2ddaf,g1162b98a3f+b2075782a9,g2079a07aa2+1b2e822518,g2bbee38e9b+c6dfa2ddaf,g337abbeb29+c6dfa2ddaf,g3ddfee87b4+a60788ef87,g50ff169b8f+2eb0e556e8,g52b1c1532d+90ebb246c7,g555ede804d+a60788ef87,g591dd9f2cf+ba8caea58f,g5ec818987f+864ee9cddb,g858d7b2824+9ee1ab4172,g876c692160+a40945ebb7,g8a8a8dda67+90ebb246c7,g8cdfe0ae6a+4fd9e222a8,g99cad8db69+5e309b7bc6,g9ddcbc5298+a1346535a5,ga1e77700b3+df8f93165b,ga8c6da7877+aa12a14d27,gae46bcf261+c6dfa2ddaf,gb0e22166c9+8634eb87fb,gb3f2274832+d0da15e3be,gba4ed39666+1ac82b564f,gbb8dafda3b+5dfd9c994b,gbeb006f7da+97157f9740,gc28159a63d+c6dfa2ddaf,gc86a011abf+9ee1ab4172,gcf0d15dbbd+a60788ef87,gdaeeff99f8+1cafcb7cd4,gdc0c513512+9ee1ab4172,ge79ae78c31+c6dfa2ddaf,geb67518f79+ba1859f325,geb961e4c1e+f9439d1e6f,gee10cc3b42+90ebb246c7,gf1cff7945b+9ee1ab4172,w.2024.12
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Static Protected Attributes | List of all members
lsst.meas.algorithms.makePsfCandidates.MakePsfCandidatesTask Class Reference
Inheritance diagram for lsst.meas.algorithms.makePsfCandidates.MakePsfCandidatesTask:

Public Member Functions

 run (self, starCat, exposure, psfCandidateField=None)
 
 makePsfCandidates (self, starCat, exposure)
 

Static Public Attributes

 ConfigClass = MakePsfCandidatesConfig
 

Static Protected Attributes

str _DefaultName = "makePsfCandidates"
 

Detailed Description

Create PSF candidates given an input catalog.

Definition at line 47 of file makePsfCandidates.py.

Member Function Documentation

◆ makePsfCandidates()

lsst.meas.algorithms.makePsfCandidates.MakePsfCandidatesTask.makePsfCandidates ( self,
starCat,
exposure )
Make a list of PSF candidates from a star catalog.

Parameters
----------
starCat : `lsst.afw.table.SourceCatalog`
    Catalog of stars, as returned by
    ``lsst.meas.algorithms.starSelector.run()``.
exposure : `lsst.afw.image.Exposure`
    The exposure containing the sources.

Returns
-------
struct : `lsst.pipe.base.Struct`
    Results struct containing:

    - ``psfCandidates`` : List of PSF candidates
        (`list` of `lsst.meas.algorithms.PsfCandidate`).
    - ``goodStarCat`` : Subset of ``starCat`` that was successfully made
        into PSF candidates (`lsst.afw.table.SourceCatalog`).

Definition at line 87 of file makePsfCandidates.py.

87 def makePsfCandidates(self, starCat, exposure):
88 """Make a list of PSF candidates from a star catalog.
89
90 Parameters
91 ----------
92 starCat : `lsst.afw.table.SourceCatalog`
93 Catalog of stars, as returned by
94 ``lsst.meas.algorithms.starSelector.run()``.
95 exposure : `lsst.afw.image.Exposure`
96 The exposure containing the sources.
97
98 Returns
99 -------
100 struct : `lsst.pipe.base.Struct`
101 Results struct containing:
102
103 - ``psfCandidates`` : List of PSF candidates
104 (`list` of `lsst.meas.algorithms.PsfCandidate`).
105 - ``goodStarCat`` : Subset of ``starCat`` that was successfully made
106 into PSF candidates (`lsst.afw.table.SourceCatalog`).
107 """
108 goodStarCat = SourceCatalog(starCat.schema)
109
110 psfCandidateList = []
111 didSetSize = False
112 for star in starCat:
113 psfCandidate = makePsfCandidate(star, exposure)
114 try:
115 # The setXXX methods are class static, but it's convenient to call them on
116 # an instance as we don't know exposures's pixel type
117 # (and hence psfCandidate's exact type)
118 if not didSetSize:
119 psfCandidate.setBorderWidth(self.config.borderWidth)
120 psfCandidate.setWidth(self.config.kernelSize + 2*self.config.borderWidth)
121 psfCandidate.setHeight(self.config.kernelSize + 2*self.config.borderWidth)
122 didSetSize = True
123
124 im = psfCandidate.getMaskedImage().getImage()
126 self.log.warning("Could not get stamp for psfCandidate with source id=%s: %s",
127 star.getId(), psfCandidate)
128 continue
130 self.log.error("%s raised making psfCandidate from source id=%s: %s",
131 e.__class__.__name__, star.getId(), psfCandidate)
132 self.log.error("psfCandidate exception: %s", e)
133 continue
134
135 vmax = afwMath.makeStatistics(im, afwMath.MAX).getValue()
136 if not np.isfinite(vmax):
137 continue
138 psfCandidateList.append(psfCandidate)
139 goodStarCat.append(star)
140
141 return pipeBase.Struct(
142 psfCandidates=psfCandidateList,
143 goodStarCat=goodStarCat,
144 )
Provides consistent interface for LSST exceptions.
Definition Exception.h:107
Reports attempts to exceed implementation-defined length limits for some classes.
Definition Runtime.h:76
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:361

◆ run()

lsst.meas.algorithms.makePsfCandidates.MakePsfCandidatesTask.run ( self,
starCat,
exposure,
psfCandidateField = None )
Make a list of PSF candidates from a star catalog.

Parameters
----------
starCat : `lsst.afw.table.SourceCatalog`
    Catalog of stars, as returned by
    ``lsst.meas.algorithms.starSelector.run()``.
exposure : `lsst.afw.image.Exposure`
    The exposure containing the sources.
psfCandidateField : `str`, optional
    Name of flag field to set True for PSF candidates, or None to not
    set a field; the field is left unchanged for non-candidates.

Returns
-------
struct : `lsst.pipe.base.Struct`
    Results struct containing:

    - ``psfCandidates`` : List of PSF candidates
        (`list` of `lsst.meas.algorithms.PsfCandidate`).
    - ``goodStarCat`` : Subset of ``starCat`` that was successfully made
        into PSF candidates (`lsst.afw.table.SourceCatalog`).

Definition at line 53 of file makePsfCandidates.py.

53 def run(self, starCat, exposure, psfCandidateField=None):
54 """Make a list of PSF candidates from a star catalog.
55
56 Parameters
57 ----------
58 starCat : `lsst.afw.table.SourceCatalog`
59 Catalog of stars, as returned by
60 ``lsst.meas.algorithms.starSelector.run()``.
61 exposure : `lsst.afw.image.Exposure`
62 The exposure containing the sources.
63 psfCandidateField : `str`, optional
64 Name of flag field to set True for PSF candidates, or None to not
65 set a field; the field is left unchanged for non-candidates.
66
67 Returns
68 -------
69 struct : `lsst.pipe.base.Struct`
70 Results struct containing:
71
72 - ``psfCandidates`` : List of PSF candidates
73 (`list` of `lsst.meas.algorithms.PsfCandidate`).
74 - ``goodStarCat`` : Subset of ``starCat`` that was successfully made
75 into PSF candidates (`lsst.afw.table.SourceCatalog`).
76
77 """
78 psfResult = self.makePsfCandidates(starCat, exposure)
79
80 if psfCandidateField is not None:
81 isStarKey = starCat.schema[psfCandidateField].asKey()
82 for star in psfResult.goodStarCat:
83 star.set(isStarKey, True)
84
85 return psfResult
86

Member Data Documentation

◆ _DefaultName

str lsst.meas.algorithms.makePsfCandidates.MakePsfCandidatesTask._DefaultName = "makePsfCandidates"
staticprotected

Definition at line 51 of file makePsfCandidates.py.

◆ ConfigClass

lsst.meas.algorithms.makePsfCandidates.MakePsfCandidatesTask.ConfigClass = MakePsfCandidatesConfig
static

Definition at line 50 of file makePsfCandidates.py.


The documentation for this class was generated from the following file: