LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
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