Loading [MathJax]/extensions/tex2jax.js
LSST Applications g04dff08e69+42feea4ef2,g0fba68d861+a0b9de4ea6,g1ec0fe41b4+f536777771,g1fd858c14a+42269675ea,g35bb328faa+fcb1d3bbc8,g4af146b050+bbef1ba6f0,g4d2262a081+8f21adb3a6,g53246c7159+fcb1d3bbc8,g5a012ec0e7+b20b785ecb,g60b5630c4e+43e3f0d37c,g6273192d42+e9a7147bac,g67b6fd64d1+4086c0989b,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g7bbe65ff3e+43e3f0d37c,g8352419a5c+fcb1d3bbc8,g87b7deb4dc+43704db330,g8852436030+eb2388797a,g89139ef638+4086c0989b,g9125e01d80+fcb1d3bbc8,g94187f82dc+43e3f0d37c,g989de1cb63+4086c0989b,g9d31334357+43e3f0d37c,g9f33ca652e+9b312035f9,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+61f2793e68,gb58c049af0+f03b321e39,gb89ab40317+4086c0989b,gc0bb628dac+834c1753f9,gcf25f946ba+eb2388797a,gd6cbbdb0b4+af3c3595f5,gde0f65d7ad+9e0145b227,ge278dab8ac+d65b3c2b70,ge410e46f29+4086c0989b,gf23fb2af72+37a5db1cfd,gf67bdafdda+4086c0989b,v29.0.0.rc7
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
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
123
132 virtual std::shared_ptr<Psf> resized(int width, int height) const = 0;
133
155 image::Color color = image::Color(),
156 ImageOwnerEnum owner = COPY) const;
157
158
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
223 geom::ellipses::Quadrupole computeShape(lsst::geom::Point2D position,
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;
360 virtual geom::ellipses::Quadrupole doComputeShape(lsst::geom::Point2D const& position,
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
lsst::geom::Box2I computeBBox(lsst::geom::Point2D position, image::Color color=image::Color()) const
Return the bounding box of the image returned by computeKernelImage()
Definition Psf.cc:127
math::Kernel::Pixel Pixel
Pixel type of Image returned by computeImage.
Definition Psf.h:88
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:114
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...
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:165
Psf & operator=(Psf &&)=delete
Psf(Psf const &)
Definition Psf.cc:78
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:101
double computePeak(lsst::geom::Point2D position, image::Color color=image::Color()) const
Return the peak value of the PSF image.
Definition Psf.cc:158
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
@ COPY
The image will be copied before returning; caller will own it.
Definition Psf.h:93
@ INTERNAL
An internal image will be returned without copying.
Definition Psf.h:94
virtual lsst::geom::Box2I doComputeBBox(lsst::geom::Point2D const &position, image::Color const &color) const =0
std::shared_ptr< math::Kernel const > getLocalKernel(lsst::geom::Point2D position, image::Color color=image::Color()) const
Return a FixedKernel corresponding to the Psf image at the given point.
Definition Psf.cc:149
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
image::Image< Pixel > Image
Image type returned by computeImage.
Definition Psf.h:89
virtual geom::ellipses::Quadrupole doComputeShape(lsst::geom::Point2D const &position, image::Color const &color) const =0
geom::ellipses::Quadrupole computeShape(lsst::geom::Point2D position, image::Color color=image::Color()) const
Compute the ellipse corresponding to the second moments of the Psf.
Definition Psf.cc:171
Describe the colour of a source.
Definition Color.h:25
A class to represent a 2-dimensional array of pixels.
Definition Image.h:51
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
T quiet_NaN(T... args)