LSST Applications g042eb84c57+730a74494b,g04e9c324dd+8c5ae1fdc5,g134cb467dc+1f1e3e7524,g199a45376c+0ba108daf9,g1fd858c14a+fa7d31856b,g210f2d0738+f66ac109ec,g262e1987ae+83a3acc0e5,g29ae962dfc+d856a2cb1f,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+a1e0c9f713,g47891489e3+0d594cb711,g4d44eb3520+c57ec8f3ed,g4d7b6aa1c5+f66ac109ec,g53246c7159+8c5ae1fdc5,g56a1a4eaf3+fd7ad03fde,g64539dfbff+f66ac109ec,g67b6fd64d1+0d594cb711,g67fd3c3899+f66ac109ec,g6985122a63+0d594cb711,g74acd417e5+3098891321,g786e29fd12+668abc6043,g81db2e9a8d+98e2ab9f28,g87389fa792+8856018cbb,g89139ef638+0d594cb711,g8d7436a09f+80fda9ce03,g8ea07a8fe4+760ca7c3fc,g90f42f885a+033b1d468d,g97be763408+a8a29bda4b,g99822b682c+e3ec3c61f9,g9d5c6a246b+0d5dac0c3d,ga41d0fce20+9243b26dd2,gbf99507273+8c5ae1fdc5,gd7ef33dd92+0d594cb711,gdab6d2f7ff+3098891321,ge410e46f29+0d594cb711,geaed405ab2+c4bbc419c6,gf9a733ac38+8c5ae1fdc5,w.2025.38
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,
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:23
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)