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
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
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
std::shared_ptr< Image > computeImage() const
Definition: Psf.cc:101
lsst::geom::Box2I computeKernelBBox() const
Definition: Psf.h:332
Psf & operator=(Psf &&)=delete
std::shared_ptr< Image > computeKernelImage() const
Definition: Psf.cc:118
Psf(Psf const &)
Definition: Psf.cc:78
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 class to represent a 2-dimensional array of pixels.
Definition: Image.h:51
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
A base class for image defects.