LSST Applications g0f08755f38+82efc23009,g12f32b3c4e+e7bdf1200e,g1653933729+a8ce1bb630,g1a0ca8cf93+50eff2b06f,g28da252d5a+52db39f6a5,g2bbee38e9b+37c5a29d61,g2bc492864f+37c5a29d61,g2cdde0e794+c05ff076ad,g3156d2b45e+41e33cbcdc,g347aa1857d+37c5a29d61,g35bb328faa+a8ce1bb630,g3a166c0a6a+37c5a29d61,g3e281a1b8c+fb992f5633,g414038480c+7f03dfc1b0,g41af890bb2+11b950c980,g5fbc88fb19+17cd334064,g6b1c1869cb+12dd639c9a,g781aacb6e4+a8ce1bb630,g80478fca09+72e9651da0,g82479be7b0+04c31367b4,g858d7b2824+82efc23009,g9125e01d80+a8ce1bb630,g9726552aa6+8047e3811d,ga5288a1d22+e532dc0a0b,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+37c5a29d61,gcf0d15dbbd+2acd6d4d48,gd7358e8bfb+778a810b6e,gda3e153d99+82efc23009,gda6a2b7d83+2acd6d4d48,gdaeeff99f8+1711a396fd,ge2409df99d+6b12de1076,ge79ae78c31+37c5a29d61,gf0baf85859+d0a5978c5a,gf3967379c6+4954f8c433,gfb92a5be7c+82efc23009,gfec2e1e490+2aaed99252,w.2024.46
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/pex/exceptions.h"
38
39namespace lsst {
40namespace afw {
41namespace detection {
42namespace detail {
43
45struct PsfCacheKey;
46
47} // namespace detail
48
53
54
81class Psf : public afw::table::io::PersistableFacade<Psf>,
82 public afw::typehandling::Storable {
83 static lsst::geom::Point2D makeNullPoint() {
85 }
86
87public:
90
93 COPY = 0,
94 INTERNAL = 1
98 };
99
100 Psf(Psf const&);
101 Psf& operator=(Psf const&) = delete;
102 Psf& operator=(Psf&&) = delete;
103
104 Psf(Psf&&);
105 ~Psf() override;
106
114 virtual std::shared_ptr<Psf> clone() const = 0;
115
122 std::shared_ptr<typehandling::Storable> cloneStorable() const override { return clone(); }
123
132 virtual std::shared_ptr<Psf> resized(int width, int height) const = 0;
133
154 std::shared_ptr<Image> computeImage(lsst::geom::Point2D position,
155 image::Color color = image::Color(),
156 ImageOwnerEnum owner = COPY) const;
157
158
181 std::shared_ptr<Image> computeKernelImage(lsst::geom::Point2D position,
182 image::Color color = image::Color(),
183 ImageOwnerEnum owner = COPY) const;
184
196 double computePeak(lsst::geom::Point2D position,
197 image::Color color = image::Color()) const;
198
210 double computeApertureFlux(double radius, lsst::geom::Point2D position,
211 image::Color color = image::Color()) const;
212
224 image::Color color = image::Color()) const;
225
237 image::Color color = image::Color()) const;
238
239
246
252 virtual lsst::geom::Point2D getAveragePosition() const;
253
261 lsst::geom::Box2I computeBBox(lsst::geom::Point2D position,
262 image::Color color = image::Color()) const;
263
271 lsst::geom::Box2I computeImageBBox(lsst::geom::Point2D position,
272 image::Color color = image::Color()) const;
273
283 image::Color color = image::Color()) const {
284 return computeBBox(position, color);
285 }
286
305 static std::shared_ptr<Image> recenterKernelImage(std::shared_ptr<Image> im,
306 lsst::geom::Point2D const& position,
307 std::string const& warpAlgorithm = "lanczos5",
308 unsigned int warpBuffer = 5);
309
314 std::size_t getCacheCapacity() const;
315
320 void setCacheCapacity(std::size_t capacity);
321
322protected:
330 explicit Psf(bool isFixed = false, std::size_t capacity = 100);
331
333
341 virtual std::shared_ptr<Image> doComputeImage(lsst::geom::Point2D const& position,
342 image::Color const& color) const;
343 virtual lsst::geom::Box2I doComputeImageBBox(lsst::geom::Point2D const& position,
344 image::Color const& color) const;
346
347private:
349
357 image::Color const& color) const = 0;
358 virtual double doComputeApertureFlux(double radius, lsst::geom::Point2D const& position,
359 image::Color const& color) const = 0;
361 image::Color const& color) const = 0;
363 image::Color const& color) const = 0;
365
366 bool const _isFixed;
368 std::unique_ptr<PsfCache> _imageCache;
369 std::unique_ptr<PsfCache> _kernelImageCache;
370};
371} // namespace detection
372} // namespace afw
373} // namespace lsst
374
375#endif // !LSST_AFW_DETECTION_Psf_h_INCLUDED
#define LSST_EXCEPTION_TYPE(t, b, c)
Macro used to define new types of exceptions without additional data.
Definition Exception.h:69
An exception thrown when we have an invalid PSF.
Definition Psf.h:52
A polymorphic base class for representing an image's Point Spread Function.
Definition Psf.h:82
Psf & operator=(Psf const &)=delete
std::shared_ptr< typehandling::Storable > cloneStorable() const override
Polymorphic deep-copy.
Definition Psf.h:122
math::Kernel::Pixel Pixel
Pixel type of Image returned by computeImage.
Definition Psf.h:88
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...
Psf & operator=(Psf &&)=delete
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:245
virtual std::shared_ptr< Psf > clone() const =0
Polymorphic deep-copy.
ImageOwnerEnum
Enum passed to computeImage and computeKernelImage to determine image ownership.
Definition Psf.h:92
virtual lsst::geom::Box2I doComputeBBox(lsst::geom::Point2D const &position, image::Color const &color) const =0
virtual double doComputeApertureFlux(double radius, lsst::geom::Point2D const &position, image::Color const &color) const =0
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:282
virtual geom::ellipses::Quadrupole doComputeShape(lsst::geom::Point2D const &position, image::Color const &color) const =0
An ellipse core with quadrupole moments as parameters.
Definition Quadrupole.h:47
Describe the colour of a source.
Definition Color.h:25
Cache of most recently used values.
Definition Cache.h:75
An integer coordinate rectangle.
Definition Box.h:55
Reports invalid arguments.
Definition Runtime.h:66
Point< double, 2 > Point2D
Definition Point.h:324