LSST Applications g180d380827+0f66a164bb,g2079a07aa2+86d27d4dc4,g2305ad1205+7d304bc7a0,g29320951ab+500695df56,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+e42ea45bea,g48712c4677+36a86eeaa5,g487adcacf7+2dd8f347ac,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+c70619cc9d,g5a732f18d5+53520f316c,g5ea96fc03c+341ea1ce94,g64a986408d+f7cd9c7162,g858d7b2824+f7cd9c7162,g8a8a8dda67+585e252eca,g99cad8db69+469ab8c039,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+c92fc63c7e,gbd866b1f37+f7cd9c7162,gc120e1dc64+02c66aa596,gc28159a63d+0e5473021a,gc3e9b769f7+b0068a2d9f,gcf0d15dbbd+e42ea45bea,gdaeeff99f8+f9a426f77a,ge6526c86ff+84383d05b3,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+f7cd9c7162,w.2024.17
LSST Data Management Base Package
Loading...
Searching...
No Matches
PsfCandidate.h
Go to the documentation of this file.
1// -*- LSST-C++ -*-
2#if !defined(LSST_MEAS_ALGORITHMS_PSFCANDIDATE_H)
3#define LSST_MEAS_ALGORITHMS_PSFCANDIDATE_H
4
5/*
6 * LSST Data Management System
7 * Copyright 2008, 2009, 2010 LSST Corporation.
8 *
9 * This product includes software developed by the
10 * LSST Project (http://www.lsst.org/).
11 *
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the LSST License Statement and
23 * the GNU General Public License along with this program. If not,
24 * see <http://www.lsstcorp.org/LegalNotices/>.
25 */
26
34#include <memory>
35#include <vector>
36
37#include "lsst/geom/Point.h"
43
44namespace lsst {
45namespace meas {
46namespace algorithms {
54template <typename PixelT>
56public:
60
62
70 parentExposure
71 )
72 : afw::math::SpatialCellImageCandidate(source->getX(), source->getY()),
73 _parentExposure(parentExposure),
74 _offsetImage(),
75 _source(source),
76 _image(nullptr),
77 _amplitude(0.0),
78 _var(1.0) {}
79
85 parentExposure,
86 double xCenter,
87 double yCenter
88 )
89 : afw::math::SpatialCellImageCandidate(xCenter, yCenter),
90 _parentExposure(parentExposure),
91 _offsetImage(),
92 _source(source),
93 _image(nullptr),
94 _amplitude(0.0),
95 _var(1.0) {}
96
98 virtual ~PsfCandidate(){};
99
105 double getCandidateRating() const { return _source->getPsfInstFlux(); }
106
109
111 double getAmplitude() const { return _amplitude; }
112
114 void setAmplitude(double amplitude) { _amplitude = amplitude; }
115
117 double getVar() const { return _var; }
118
120 void setVar(double var) { _var = var; }
121
123 std::shared_ptr<afw::image::MaskedImage<PixelT> const> getMaskedImage(int width, int height) const;
125 getOffsetImage(std::string const algorithm, unsigned int buffer) const;
126
128 static int getBorderWidth();
129
131 static void setBorderWidth(int border);
132
136 static void setPixelThreshold(float threshold);
137
139 static float getPixelThreshold();
140
142 static void setMaskBlends(bool doMaskBlends);
143
145 static bool getMaskBlends();
146
147private:
149 _parentExposure; // the %image that the Sources are found in
150
152 offsetImage(std::shared_ptr<afw::image::MaskedImage<PixelT>> img, std::string const algorithm, unsigned int buffer);
153
155 extractImage(unsigned int width, unsigned int height) const;
156
157 std::shared_ptr<afw::image::MaskedImage<PixelT>> mutable _offsetImage; // %image offset to put center on a pixel
158 std::shared_ptr<afw::table::SourceRecord> _source; // the Source itself
159
160 mutable std::shared_ptr<afw::image::MaskedImage<PixelT>> _image; // cutout image to return (cached)
161 double _amplitude; // best-fit amplitude of current PSF model
162 double _var; // variance to use when fitting this candidate
163 static int _border; // width of border of ignored pixels around _image
164 geom::Point2D _xyCenter;
165 static int _defaultWidth;
166 static float _pixelThreshold;
167 static bool _doMaskBlends;
168};
169
175template <typename PixelT>
177 const & source,
179 image
180 ) {
181 return std::make_shared<PsfCandidate<PixelT>>(source, image);
182}
183
184} // namespace algorithms
185} // namespace meas
186} // namespace lsst
187
188#endif
afw::table::Key< afw::table::Array< ImagePixelT > > image
A class to contain the data, WCS, and other information needed to describe an image of the sky.
Definition Exposure.h:72
A class to manipulate images, masks, and variance as a single object.
Definition MaskedImage.h:74
Base class for candidate objects in a SpatialCell that are able to return an Image of some sort (e....
Class stored in SpatialCells for spatial Psf fitting.
static float getPixelThreshold()
Get threshold for rejecting pixels unconnected with the central footprint.
std::shared_ptr< const PsfCandidate< PixelT > > ConstPtr
double getCandidateRating() const
Return Cell rating.
static bool getMaskBlends()
Get whether blends are masked.
PsfCandidate(std::shared_ptr< afw::table::SourceRecord > const &source, std::shared_ptr< afw::image::Exposure< PixelT > const > parentExposure)
Construct a PsfCandidate from a specified source and image.
static void setBorderWidth(int border)
Set the number of pixels to ignore around the candidate image's edge.
double getVar() const
Return the variance in use when fitting this object.
static int getBorderWidth()
Return the number of pixels being ignored around the candidate image's edge.
static void setPixelThreshold(float threshold)
Set threshold for rejecting pixels unconnected with the central footprint.
void setVar(double var)
Set the variance to use when fitting this object.
std::shared_ptr< afw::image::MaskedImage< PixelT > const > getMaskedImage() const
Return the image at the position of the Source, without any sub-pixel shifts to put the centre of the...
void setAmplitude(double amplitude)
Set the best-fit amplitude.
afw::image::MaskedImage< PixelT > MaskedImageT
PsfCandidate(std::shared_ptr< afw::table::SourceRecord > const &source, std::shared_ptr< afw::image::Exposure< PixelT > const > parentExposure, double xCenter, double yCenter)
Construct a PsfCandidate from a specified source, image and xyCenter.
double getAmplitude() const
Return the best-fit amplitude.
static void setMaskBlends(bool doMaskBlends)
Set whether blends are masked.
std::shared_ptr< PsfCandidate< PixelT > > Ptr
std::shared_ptr< afw::table::SourceRecord > getSource() const
Return the original Source.
std::shared_ptr< afw::image::MaskedImage< PixelT > > getOffsetImage(std::string const algorithm, unsigned int buffer) const
Return an offset version of the image of the source.
std::shared_ptr< PsfCandidate< PixelT > > makePsfCandidate(std::shared_ptr< afw::table::SourceRecord > const &source, std::shared_ptr< afw::image::Exposure< PixelT > > image)
Return a PsfCandidate of the right sort.