LSST Applications g070148d5b3+33e5256705,g0d53e28543+25c8b88941,g0da5cf3356+2dd1178308,g1081da9e2a+62d12e78cb,g17e5ecfddb+7e422d6136,g1c76d35bf8+ede3a706f7,g295839609d+225697d880,g2e2c1a68ba+cc1f6f037e,g2ffcdf413f+853cd4dcde,g38293774b4+62d12e78cb,g3b44f30a73+d953f1ac34,g48ccf36440+885b902d19,g4b2f1765b6+7dedbde6d2,g5320a0a9f6+0c5d6105b6,g56b687f8c9+ede3a706f7,g5c4744a4d9+ef6ac23297,g5ffd174ac0+0c5d6105b6,g6075d09f38+66af417445,g667d525e37+2ced63db88,g670421136f+2ced63db88,g71f27ac40c+2ced63db88,g774830318a+463cbe8d1f,g7876bc68e5+1d137996f1,g7985c39107+62d12e78cb,g7fdac2220c+0fd8241c05,g96f01af41f+368e6903a7,g9ca82378b8+2ced63db88,g9d27549199+ef6ac23297,gabe93b2c52+e3573e3735,gb065e2a02a+3dfbe639da,gbc3249ced9+0c5d6105b6,gbec6a3398f+0c5d6105b6,gc9534b9d65+35b9f25267,gd01420fc67+0c5d6105b6,geee7ff78d7+a14128c129,gf63283c776+ede3a706f7,gfed783d017+0c5d6105b6,w.2022.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
Psf.h
Go to the documentation of this file.
1// -*- LSST-C++ -*-
2/*
3 * LSST Data Management System
4 * Copyright 2008-2013 LSST Corporation.
5 *
6 * This product includes software developed by the
7 * LSST Project (http://www.lsst.org/).
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the LSST License Statement and
20 * the GNU General Public License along with this program. If not,
21 * see <http://www.lsstcorp.org/LegalNotices/>.
22 */
23#ifndef LSST_AFW_DETECTION_Psf_h_INCLUDED
24#define LSST_AFW_DETECTION_Psf_h_INCLUDED
25
26#include <string>
27#include <limits>
28
29#include <memory>
30
31#include "lsst/utils/CacheFwd.h"
37
38namespace lsst {
39namespace afw {
40namespace detection {
41namespace detail {
42
44struct PsfCacheKey;
45
46} // namespace detail
47
77 static lsst::geom::Point2D makeNullPoint() {
79 }
80
81public:
84
87 COPY = 0,
88 INTERNAL = 1
92 };
93
94 Psf(Psf const&);
95 Psf& operator=(Psf const&) = delete;
96 Psf& operator=(Psf&&) = delete;
97
98 Psf(Psf&&);
99 ~Psf() override;
100
108 virtual std::shared_ptr<Psf> clone() const = 0;
109
117
126 virtual std::shared_ptr<Psf> resized(int width, int height) const = 0;
127
149 image::Color color = image::Color(),
150 ImageOwnerEnum owner = COPY) const;
151
152 // Using the default position automatically implies use of the default color, owner.
153 [[deprecated(
154 "Default position argument overload is deprecated and will be removed "
155 "in version 24.0. Please use overload with explicit position."
156 )]]
158
182 image::Color color = image::Color(),
183 ImageOwnerEnum owner = COPY) const;
184 // Using the default position automatically implies use of the default color, owner.
185 [[deprecated(
186 "Default position argument overload is deprecated and will be removed "
187 "in version 24.0. Please use overload with explicit position."
188 )]]
190
202 double computePeak(lsst::geom::Point2D position,
203 image::Color color = image::Color()) const;
204
205 [[deprecated(
206 "Default position argument overload is deprecated and will be removed "
207 "in version 24.0. Please use overload with explicit position."
208 )]]
209 double computePeak() const;
210
222 double computeApertureFlux(double radius, lsst::geom::Point2D position,
223 image::Color color = image::Color()) const;
224
225 [[deprecated(
226 "Default position argument overload is deprecated and will be removed "
227 "in version 24.0. Please use overload with explicit position."
228 )]]
229 double computeApertureFlux(double radius) const;
230
242 image::Color color = image::Color()) const;
243
244 [[deprecated(
245 "Default position argument overload is deprecated and will be removed "
246 "in version 24.0. Please use overload with explicit position."
247 )]]
249
261 image::Color color = image::Color()) const;
262
263 [[deprecated(
264 "Default position argument overload is deprecated and will be removed "
265 "in version 24.0. Please use overload with explicit position."
266 )]]
268
275
282
291 image::Color color = image::Color()) const;
292
293 [[deprecated(
294 "Default position argument overload is deprecated and will be removed "
295 "in version 24.0. Please use overload with explicit position."
296 )]]
298
307 image::Color color = image::Color()) const;
308
309 [[deprecated(
310 "Default position argument overload is deprecated and will be removed "
311 "in version 24.0. Please use overload with explicit position."
312 )]]
314
324 image::Color color = image::Color()) const {
325 return computeBBox(position, color);
326 }
327
328 [[deprecated(
329 "Default position argument overload is deprecated and will be removed "
330 "in version 24.0. Please use overload with explicit position."
331 )]]
333 return computeBBox();
334 }
335
355 lsst::geom::Point2D const& position,
356 std::string const& warpAlgorithm = "lanczos5",
357 unsigned int warpBuffer = 5);
358
364
369 void setCacheCapacity(std::size_t capacity);
370
371protected:
379 explicit Psf(bool isFixed = false, std::size_t capacity = 100);
380
382
391 image::Color const& color) const;
393 image::Color const& color) const;
395
396private:
398
406 image::Color const& color) const = 0;
407 virtual double doComputeApertureFlux(double radius, lsst::geom::Point2D const& position,
408 image::Color const& color) const = 0;
410 image::Color const& color) const = 0;
412 image::Color const& color) const = 0;
414
415 bool const _isFixed;
417 std::unique_ptr<PsfCache> _imageCache;
418 std::unique_ptr<PsfCache> _kernelImageCache;
419};
420} // namespace detection
421} // namespace afw
422} // namespace lsst
423
424#endif // !LSST_AFW_DETECTION_Psf_h_INCLUDED
A polymorphic base class for representing an image's Point Spread Function.
Definition: Psf.h:76
Psf & operator=(Psf const &)=delete
std::shared_ptr< typehandling::Storable > cloneStorable() const override
Polymorphic deep-copy.
Definition: Psf.h:116
static std::shared_ptr< Image > recenterKernelImage(std::shared_ptr< Image > im, lsst::geom::Point2D const &position, std::string const &warpAlgorithm="lanczos5", unsigned int warpBuffer=5)
Helper function for Psf::doComputeImage(): converts a kernel image (centered at (0,...
Definition: Psf.cc:85
math::Kernel::Pixel Pixel
Pixel type of Image returned by computeImage.
Definition: Psf.h:82
lsst::geom::Box2I computeBBox() const
Definition: Psf.cc:135
virtual std::shared_ptr< Image > doComputeImage(lsst::geom::Point2D const &position, image::Color const &color) const
These virtual members are protected (rather than private) so that python-implemented derived classes ...
Definition: Psf.cc:209
std::shared_ptr< Image > computeKernelImage(lsst::geom::Point2D position, image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const
Return an Image of the PSF, in a form suitable for convolution.
Definition: Psf.cc:122
lsst::geom::Box2I computeImageBBox() const
Definition: Psf.cc:150
virtual std::shared_ptr< Image > doComputeKernelImage(lsst::geom::Point2D const &position, image::Color const &color) const =0
These virtual member functions are private, not protected, because we only want derived classes to im...
std::size_t getCacheCapacity() const
Return the capacity of the caches.
Definition: Psf.cc:223
double computeApertureFlux(double radius, lsst::geom::Point2D position, image::Color color=image::Color()) const
Compute the "flux" of the Psf model within a circular aperture of the given radius.
Definition: Psf.cc:193
lsst::geom::Box2I computeKernelBBox() const
Definition: Psf.h:332
Psf & operator=(Psf &&)=delete
std::shared_ptr< Image > computeImage(lsst::geom::Point2D position, image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const
Return an Image of the PSF, in a form that can be compared directly with star images.
Definition: Psf.cc:105
double computePeak() const
Definition: Psf.cc:178
virtual std::shared_ptr< Psf > resized(int width, int height) const =0
Return clone with specified kernel dimensions.
image::Color getAverageColor() const
Return the average Color of the stars used to construct the Psf.
Definition: Psf.h:274
virtual std::shared_ptr< Psf > clone() const =0
Polymorphic deep-copy.
virtual lsst::geom::Box2I doComputeImageBBox(lsst::geom::Point2D const &position, image::Color const &color) const
Definition: Psf.cc:215
ImageOwnerEnum
Enum passed to computeImage and computeKernelImage to determine image ownership.
Definition: Psf.h:86
@ COPY
The image will be copied before returning; caller will own it.
Definition: Psf.h:87
@ INTERNAL
An internal image will be returned without copying.
Definition: Psf.h:88
virtual lsst::geom::Box2I doComputeBBox(lsst::geom::Point2D const &position, image::Color const &color) const =0
void setCacheCapacity(std::size_t capacity)
Set the capacity of the caches.
Definition: Psf.cc:225
geom::ellipses::Quadrupole computeShape() const
Definition: Psf.cc:199
virtual double doComputeApertureFlux(double radius, lsst::geom::Point2D const &position, image::Color const &color) const =0
virtual lsst::geom::Point2D getAveragePosition() const
Return the average position of the stars used to construct the Psf.
Definition: Psf.cc:221
lsst::geom::Box2I computeKernelBBox(lsst::geom::Point2D position, image::Color color=image::Color()) const
Return the bounding box of the image returned by computeImage()
Definition: Psf.h:323
virtual geom::ellipses::Quadrupole doComputeShape(lsst::geom::Point2D const &position, image::Color const &color) const =0
std::shared_ptr< math::Kernel const > getLocalKernel() const
Definition: Psf.cc:165
An ellipse core with quadrupole moments as parameters.
Definition: Quadrupole.h:47
Describe the colour of a source.
Definition: Color.h:25
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:176
Interface supporting iteration over heterogenous containers.
Definition: Storable.h:58
Cache of most recently used values.
Definition: Cache.h:75
An integer coordinate rectangle.
Definition: Box.h:55
Point< double, 2 > Point2D
Definition: Point.h:324