LSST Applications g0fba68d861+539c3c8198,g1ec0fe41b4+f0b7a83aa5,g1fd858c14a+78b1f303e5,g22210bfa2a+8e34e7f00e,g2440f9efcc+8c5ae1fdc5,g3533f9d6cb+f4db8b1b3b,g35bb328faa+8c5ae1fdc5,g3fc7d4f5b9+a4d3a2d8bb,g40d01f57dd+ad4ae80abb,g4178042926+abd409f097,g53246c7159+8c5ae1fdc5,g548d740b8c+47e4a7beb3,g60b5630c4e+f4db8b1b3b,g663da51e9b+e0f2ae43b2,g67b6fd64d1+c104138150,g78460c75b0+7e33a9eb6d,g786e29fd12+668abc6043,g8352419a5c+8c5ae1fdc5,g8852436030+d435302cbd,g89139ef638+c104138150,g8b40312ef5+5b6744d273,g90aefe88b0+c7f866738c,g989de1cb63+c104138150,g9f33ca652e+0b88989aa6,ga2f891cd6c+f4db8b1b3b,gabe3b4be73+8856018cbb,gabf8522325+5cb9e9d408,gb1101e3267+78d08b86ce,gb89ab40317+c104138150,gcf25f946ba+d435302cbd,gd6cbbdb0b4+be834e5da7,gde0f65d7ad+a7114e3dba,ge278dab8ac+fa35eb453c,ge410e46f29+c104138150,gf35d7ec915+97dd712d81,gf5e32f922b+8c5ae1fdc5,gf67bdafdda+c104138150,gffe7e49bb4+f4db8b1b3b,v29.1.0.rc2
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#include <string>
37#include <limits>
38
39#include "lsst/geom/Point.h"
45
46namespace lsst {
47namespace meas {
48namespace algorithms {
56template <typename PixelT>
58public:
62
64
72 parentExposure
73 )
74 : afw::math::SpatialCellImageCandidate(source->getX(), source->getY()),
75 _parentExposure(parentExposure),
76 _offsetImage(),
77 _source(source),
78 _image(nullptr),
79 _amplitude(0.0),
80 _var(1.0),
81 _psfColorValue(std::numeric_limits<double>::quiet_NaN()),
82 _psfColorType() {}
83
89 parentExposure,
90 double xCenter,
91 double yCenter
92 )
93 : afw::math::SpatialCellImageCandidate(xCenter, yCenter),
94 _parentExposure(parentExposure),
95 _offsetImage(),
96 _source(source),
97 _image(nullptr),
98 _amplitude(0.0),
99 _var(1.0),
100 _psfColorValue(std::numeric_limits<double>::quiet_NaN()),
101 _psfColorType() {}
102
104 virtual ~PsfCandidate(){};
105
111 double getCandidateRating() const { return _source->getPsfInstFlux(); }
112
115
117 double getAmplitude() const { return _amplitude; }
118
120 void setAmplitude(double amplitude) { _amplitude = amplitude; }
121
123 void setPsfColorValue(double psfColorValue) { _psfColorValue = psfColorValue; }
124
126 double getPsfColorValue() const { return _psfColorValue; }
127
129 void setPsfColorType(std::string psfColorType) { _psfColorType = psfColorType; }
130
132 std::string getPsfColorType() const { return _psfColorType; }
133
135 double getVar() const { return _var; }
136
138 void setVar(double var) { _var = var; }
139
141 std::shared_ptr<afw::image::MaskedImage<PixelT> const> getMaskedImage(int width, int height) const;
143 getOffsetImage(std::string const algorithm, unsigned int buffer) const;
144
146 static int getBorderWidth();
147
149 static void setBorderWidth(int border);
150
154 static void setPixelThreshold(float threshold);
155
157 static float getPixelThreshold();
158
160 static void setMaskBlends(bool doMaskBlends);
161
163 static bool getMaskBlends();
164
165private:
167 _parentExposure; // the %image that the Sources are found in
168
170 offsetImage(std::shared_ptr<afw::image::MaskedImage<PixelT>> img, std::string const algorithm, unsigned int buffer);
171
173 extractImage(unsigned int width, unsigned int height) const;
174
175 std::shared_ptr<afw::image::MaskedImage<PixelT>> mutable _offsetImage; // %image offset to put center on a pixel
176 std::shared_ptr<afw::table::SourceRecord> _source; // the Source itself
177
178 mutable std::shared_ptr<afw::image::MaskedImage<PixelT>> _image; // cutout image to return (cached)
179 double _amplitude; // best-fit amplitude of current PSF model
180 double _var; // variance to use when fitting this candidate
181 double _psfColorValue; // psf color value use when fitting this candidate
182 std::string _psfColorType; // psf color type use when fitting this candidate
183 static int _border; // width of border of ignored pixels around _image
184 geom::Point2D _xyCenter;
185 static int _defaultWidth;
186 static float _pixelThreshold;
187 static bool _doMaskBlends;
188};
189
195template <typename PixelT>
203
204} // namespace algorithms
205} // namespace meas
206} // namespace lsst
207
208#endif
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....
SpatialCellImageCandidate(float const xCenter, float const yCenter)
ctor
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.
void setPsfColorValue(double psfColorValue)
Set psf color value to use for PSF fit.
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.
void setPsfColorType(std::string psfColorType)
Set psf color type to use for PSF fit.
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
std::string getPsfColorType() const
Return psf color type to use for PSF fit.
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.
double getPsfColorValue() const
Return psf color value to use for PSF fit.
T make_shared(T... args)
Point< double, 2 > Point2D
Definition Point.h:324
bool PsfCandidate< PixelT >::_doMaskBlends
float PsfCandidate< PixelT >::_pixelThreshold
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.
int PsfCandidate< PixelT >::_border
int PsfCandidate< PixelT >::_defaultWidth
STL namespace.