LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
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/daf/base.h"
33 #include "lsst/afw/math/Kernel.h"
34 #include "lsst/afw/image/Color.h"
36 
37 namespace lsst { namespace afw { namespace detection {
38 
39 class PsfFormatter;
40 
70 {
72  return geom::Point2D(std::numeric_limits<double>::quiet_NaN());
73  }
74 public:
75  typedef std::shared_ptr<Psf> Ptr;
76  typedef std::shared_ptr<const Psf> ConstPtr;
77 
80 
83  COPY=0,
88  };
89 
90  virtual ~Psf() {}
91 
99  virtual PTR(Psf) clone() const = 0;
100 
122  geom::Point2D position=makeNullPoint(),
123  image::Color color=image::Color(),
124  ImageOwnerEnum owner=COPY
125  ) const;
126 
150  geom::Point2D position=makeNullPoint(),
151  image::Color color=image::Color(),
152  ImageOwnerEnum owner=COPY
153  ) const;
154 
166  double computePeak(
167  geom::Point2D position=makeNullPoint(),
168  image::Color color=image::Color()
169  ) const;
170 
182  double computeApertureFlux(
183  double radius,
184  geom::Point2D position=makeNullPoint(),
185  image::Color color=image::Color()
186  ) const;
187 
198  geom::ellipses::Quadrupole computeShape(
199  geom::Point2D position=makeNullPoint(),
200  image::Color color=image::Color()
201  ) const;
202 
209  PTR(math::Kernel const) getLocalKernel(
210  geom::Point2D position=makeNullPoint(),
211  image::Color color=image::Color()
212  ) const;
213 
219  image::Color getAverageColor() const { return image::Color(); }
220 
226  virtual geom::Point2D getAveragePosition() const;
227 
232  geom::Point2D position = makeNullPoint(),
233  image::Color color = image::Color()
234  ) const;
235 
254  static PTR(Image) recenterKernelImage(
255  PTR(Image) im,
256  geom::Point2D const & position,
257  std::string const & warpAlgorithm = "lanczos5",
258  unsigned int warpBuffer = 5
259  );
260 
261 protected:
262 
269  explicit Psf(bool isFixed=false);
270 
271 private:
272 
274 
281  virtual PTR(Image) doComputeImage(
282  geom::Point2D const & position, image::Color const& color
283  ) const;
284  virtual PTR(Image) doComputeKernelImage(
285  geom::Point2D const & position, image::Color const & color
286  ) const = 0;
287  virtual double doComputeApertureFlux(
288  double radius, geom::Point2D const & position, image::Color const & color
289  ) const = 0;
290  virtual geom::ellipses::Quadrupole doComputeShape(
291  geom::Point2D const & position, image::Color const & color
292  ) const = 0;
293  virtual geom::Box2I doComputeBBox(
294  geom::Point2D const & position, image::Color const & color
295  ) const = 0;
297 
298  bool const _isFixed;
301  mutable image::Color _cachedImageColor;
305 
307 };
308 
309 }}} // namespace lsst::afw::detection
310 
311 #endif // !LSST_AFW_DETECTION_Psf_h_INCLUDED
virtual geom::ellipses::Quadrupole doComputeShape(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...
boost::shared_ptr< Image > computeKernelImage(geom::Point2D position=makeNullPoint(), image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const
Return an Image of the PSF, in a form suitable for convolution.
image::Color _cachedKernelImageColor
Definition: Psf.h:302
Declare the Kernel class and subclasses.
geom::Point2D _cachedKernelImagePosition
Definition: Psf.h:304
#define LSST_PERSIST_FORMATTER(formatter...)
Macro used to connect the persistable class with the Formatter and boost::serialization.
Definition: Persistable.h:98
image::Color getAverageColor() const
Return the average Color of the stars used to construct the Psf.
Definition: Psf.h:219
virtual boost::shared_ptr< Image > doComputeImage(geom::Point2D const &position, image::Color const &color) const
These virtual member functions are private, not protected, because we only want derived classes to im...
boost::shared_ptr< Image > computeImage(geom::Point2D position=makeNullPoint(), 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.
ImageOwnerEnum
Enum passed to computeImage and computeKernelImage to determine image ownership.
Definition: Psf.h:82
virtual boost::shared_ptr< Image > doComputeKernelImage(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...
boost::shared_ptr< Image > _cachedImage
Definition: Psf.h:299
virtual double doComputeApertureFlux(double radius, 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...
An integer coordinate rectangle.
Definition: Box.h:53
Definitions and inlines for Quadrupole.
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:72
std::shared_ptr< Psf > Ptr
Definition: Psf.h:75
math::Kernel::Pixel Pixel
Pixel type of Image returned by computeImage.
Definition: Psf.h:78
virtual ~Psf()
Definition: Psf.h:90
boost::shared_ptr< Image > _cachedKernelImage
Definition: Psf.h:300
Formatter for persistence of Psf instances.
Definition: PsfFormatter.h:30
static geom::Point2D makeNullPoint()
Definition: Psf.h:71
virtual geom::Point2D getAveragePosition() const
Return the average position of the stars used to construct the Psf.
#define PTR(...)
Definition: base.h:41
double computePeak(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Return the peak value of the PSF image.
std::shared_ptr< const Psf > ConstPtr
Definition: Psf.h:76
boost::shared_ptr< math::Kernel const > getLocalKernel(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Return a FixedKernel corresponding to the Psf image at the given point.
geom::ellipses::Quadrupole computeShape(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Compute the ellipse corresponding to the second moments of the Psf.
Point< double, 2 > Point2D
Definition: Point.h:288
Capture the colour of an object.
geom::Point2D _cachedImagePosition
Definition: Psf.h:303
Base class for all persistable classes.
Definition: Persistable.h:74
An internal image will be returned without copying.
Definition: Psf.h:84
static boost::shared_ptr< Image > recenterKernelImage(boost::shared_ptr< Image > im, 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,0) when xy0 is taken into account) to an image centered at position when xy0 is taken into account.
bool const _isFixed
Definition: Psf.h:298
Describe the colour of a source.
Definition: Color.h:27
double computeApertureFlux(double radius, geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Compute the &quot;flux&quot; of the Psf model within a circular aperture of the given radius.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:53
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:68
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:180
image::Color _cachedImageColor
Definition: Psf.h:301
image::Image< Pixel > Image
Image type returned by computeImage.
Definition: Psf.h:79
virtual geom::Box2I doComputeBBox(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...
virtual boost::shared_ptr< Psf > clone() const =0
Polymorphic deep-copy.
The image will be copied before returning; caller will own it.
Definition: Psf.h:83
geom::Box2I computeBBox(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Return the bounding box of the image returned by computeKernelImage()